ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
null, null, null, null);
if (cur.getCount() > 0) {
while (cur.moveToNext()) {
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
c_Name.add(name);
} }
name_Val = (String[]) c_Name.toArray(new String[c_Name.size()]);
//phone_Val= (String[]) c_Number.toArray(new String[c_Name.size()]);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,name_Val);
txtPhoneName.setAdapter(adapter);
ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); if (cur.getCount()
Share
Why bind to an ArrayList? You can bind directly to cur using SimpleCursorAdapter.
what is autocompletetextView?
It’s difficult to tell what exactly is going on because so much of the application is missing.
Also, what exactly are you trying to do? There may be an easier way to do it.