How to auto fill an edit text in android application?

北城以北 提交于 2019-12-06 02:00:40

When you want to populate it just call (after reading it in from the XML layout in this example):

EditText myTextBox = (EditText) findViewById(R.id.editBox);
myTextBox.setText("My Product Description");

If what you are looking for is an auto completion after they have started typing, then an AutoCompleteTextView is your best bet, replacing the EditText and providing the auto complete functionality

There is an example of this over at the Android Developers website: http://developer.android.com/guide/topics/ui/controls/text.html#AutoComplete

you can use autocomplete textview for suggestion of your all the product names, refer this example http://saigeethamn.blogspot.in/2010/05/auto-complete-text-view-android.html

or you just want to show when app launches, use hint

android:hint="@string/enterproduct"

I Dont get u clearly.. Sooo. If u want to show text that which user has to fill use Hint.

 android:hint="Enter any Filpcart Item"

OR If u need auto complete text then use above link @kumaand.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!