I need to implement an AutoCompeleteTextView application, such as the default application. I have already implemented it, as shown in the first image. Now I want exactly as indicated in the second image.

The following piece of code that I use:
Cursor cursor = this.getContentResolver().query(Phone.CONTENT_URI, new String[] { Phone.DISPLAY_NAME, Phone.NUMBER }, null, null, Phone.DISPLAY_NAME + " ASC"); startManagingCursor(cursor); cursor.moveToFirst(); int i = 0; do { HashMap<String, String> map = new HashMap<String, String>(); map.put("No", cursor.getString(cursor.getColumnIndex(Phone.NUMBER)) .replace("-", "")); map.put("Name", cursor.getString(cursor.getColumnIndex(Phone.DISPLAY_NAME))); list.add(map); i++; } while (cursor.moveToNext()); SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.autocomplete, new String[] { "Name", "No" }, new int[] { R.id.name, R.id.number }); txt_mobile_no.setAdapter(adapter); txt_mobile_no .setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
and layout file: autocomplete.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="40dip" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/name" android:textSize="16dip" android:layout_weight="1" android:textColor="#000000" android:paddingLeft="6dip" android:paddingTop="10dip"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/number" android:textSize="16dip" android:layout_weight="1" android:textColor="#000000" android:paddingTop="10dip"/> </LinearLayout>
Now, please, can someone suggest me a better way to implement this feature.
Vikas Patidar
source share