如何自动填写Android应用程序编辑的文本?

问题描述:

我正在开发一款使用Android操作系统的应用程序。在这我有一些产品,并形成购买该产品。在订单我有一个编辑文本的产品(指产品名称)。

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) .

在我的应用程序的用户必须输入产品名称,但我想知道,有没有什么办法,
所述的EditText字段自动填充与该特定产品等作为在flipcart

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...

在此先感谢...

当你想填充它只是调用(在这个例子从XML布局看完后):

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");

如果你正在寻找的是在他们已经开始打字的自动完成,那么 AutoCompleteTextView 是你最好的选择,更换的EditText并提供自动完成功能

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

有是这种过度的Andr​​oid开发者网站的例子:
http://developer.android.com/guide/topics/ui /controls/text.html#AutoComplete

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