我是新来的android。我有一个键盘和一个联系人列表。我想使用键盘和autocompleteTextView
在联系人列表中进行搜索。有人能给我一些例子吗?我没有在互联网上找到这类问题的例子。android自动完成textview和搜索联系人列表
任何帮助表示赞赏。
我是新来的android。我有一个键盘和一个联系人列表。我想使用键盘和autocompleteTextView
在联系人列表中进行搜索。有人能给我一些例子吗?我没有在互联网上找到这类问题的例子。android自动完成textview和搜索联系人列表
任何帮助表示赞赏。
========>phoneArr====> which contains ur all contacts
if(phoneArr.length > 0)
{
AutoCompleteTextView textView = (AutoCompleteTextView) this.findViewById(R.id.empphonenumber);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.auto_list_item, phoneArr);
textView.setAdapter(adapter);
}
=======>
auto_list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="16sp"
android:background="@android:color/transparent"
android:textColor="#000">
通过这种方式,您可以添加适配器与Autocomplete listview
。其比前一个
你怎么recomand?我应该将所有联系人列表添加到数据库中吗?需要很长时间才能显示所有数据库元素?我应该这样做吗?如果我有超过2000名联系人呢? – 2012-07-23 08:31:44
我刚才举了一个例子。你可以用你自己的方式来实现。不需要将联系人添加到数据库。我会告诉你如何使用自动完成列表。只是等待 – 2012-07-23 08:33:51
我改变了我的answer.check一次 – 2012-07-23 08:41:00