Abhay
Abhay

Reputation: 83

How to auto fill an edit text in android application?

I am developing one android application. In which I have some Products and form to purchase that product. In the Order form I have one Edit Text as Product ( means product name) .

In my application user has to type Product name but I want to know that Is there any way that the EditText field is autofilled with that particular Product like as in flipcart.

Any one knows then suggest me...

Thanks in advance...

Upvotes: 4

Views: 23905

Answers (5)

Akash Mahajan
Akash Mahajan

Reputation: 58

Add into the XML file

android:autofillHints="emailAddress"

or

android:autofillHints="password"

Upvotes: 0

Faisal Ansari
Faisal Ansari

Reputation: 11

Here you can use "input type" in XML design according to the text field.

Upvotes: 0

sandeep
sandeep

Reputation: 481

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.

Upvotes: 1

kumar_android
kumar_android

Reputation: 2263

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"

Upvotes: 1

biddulph.r
biddulph.r

Reputation: 5266

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

Upvotes: 8

Related Questions