先生,我们如何将 autocompletext 联系人与 android.contact 中的 listview 联系人匹配从 phone.contact 中选择所有联系人。请告诉我如何同时匹配联系人搜索 autcomplete 和 listviw。
String products[]= { contactsList.};
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
contactsList = (ListView) view.findViewById(R.id.contactsList);
contactsList.setOnItemClickListener(this);
contactsList.setTextFilterEnabled(true);
inputSearch=(AutoCompleteTextView) view.findViewById(R.id.inputSearch);
contactsList.setAdapter(new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1,products ));
inputSearch.setThreshold(1);
inputSearch.setAdapter(adapter);
inputSearch.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
inputSearch.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
Map<String, String> map = (Map<String, String>)arg0.getItemAtPosition(arg2);
String name = map.get("Name");
String number = map.get("Phone");
inputSearch.setText(""+name+"<"+number+">");
}
}) ;`
return view;