Hello, I have use the Autocompletetextview for filter the phonenumber from list when i press in the Autocompletetextview.My code is given below...
ArrayAdapter<String> adapter; AutoCompleteTextView txt; adapter = new ArrayAdapter<String>(mContext,android.R.layout.simple_list_item_1,getModel()); txt= (AutoCompleteTextView)((Activity) mContext).findViewById(R.id.autotxt); txt.setThreshold(1); txt.setAdapter(adapter); private List<String> getModel() { list = new ArrayList<String>(); Cursor phones=((Activity)mContext).getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null, null,null,null); //Cursor phones = ((Activity)mContext).getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,null, null); while (phones.moveToNext()) { String phoneNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); String name=phones.getString(phones.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); list.add(phoneNumber+" "+name); } phones.close(); return list; } It is work fine....whem i press 5 in Autocompletetextview then it will show me in list like "5002 jagruti".and when i click on that item then it will fillup in Autocompletetextview.But actually i need that when i press the 5 then it will show me as "5002 jagruti" and when i click on that item then it will fillup the Autocompletetextview with the only "5002".i dont want to fillthe Autocompletetextview with the name also.so can anybody know how to extract only number and fillyp in Autocompletetextview .because there is no any event for fillup the Autocompletetextview . -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en