Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old December 3rd, 2012, 04:48 PM   #1 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Dec 2012
Posts: 15
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default Set text hint problem

I'm fairly new to Android development and I've just been going through the android development tutorials for help, but I'm stuck on this.

[HIGH]protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
EditText editText = (EditText) findViewById(R.id.edit_message);

EditText.setHint(message);

setContentView(R.layout.activity_list);
}[/HIGH]

My app includes a search bar. In the first activity the user types into it what they are looking for. What I am currently trying to do is try to change the text hint to the message string. This string contains what the user typed in the previous search bar. Any ideas?

Advertisements
KarneeKarnay is offline  
Reply With Quote
sponsored links
Old December 7th, 2012, 04:49 PM   #2 (permalink)
Senior Member
 
jonbonazza's Avatar
 
Join Date: Jul 2010
Gender: Male
Posts: 1,935
 
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 482 Times in 294 Posts
Default

You need to use the addTextChangedListener() method of EditText to add a new TextWatcher subclass (TextWatcher is an interface, so you will need to either create a subclass and use it, or just provide an inline implementation).
__________________
My blog, Inverted Keystrokes, is looking for aspiring developers (not necessarily with Android) to post articles. If you have any development experience and are interested in participating, please PM me. =)
jonbonazza is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 02:55 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.