yair
yair

Reputation: 43

Convert the EditText Text to a Hint. - Android

Well. My question is

I want to make the EditText text the is insereted by the user to be a hint. Thanks.

Upvotes: 0

Views: 146

Answers (3)

Hulk
Hulk

Reputation: 2561

Use android:hint in your xml...like--

         <EditText android:hint="Hello" />   

set here watever hint you want to give

Upvotes: 0

AwadKab
AwadKab

Reputation: 3064

Try this...

EditText editText= (EditText) findViewById(R.id.edit_text);
String txt= editText.getText().toString();
editText.messageText.setHint(txt);

Hope this will help you.

Upvotes: 0

jcw
jcw

Reputation: 5162

I think that you want to do this

String text = edittext.getText();
edittext.setHint(text);

Upvotes: 1

Related Questions