Hello, I have made custom view for autocompletetextview, but when I am
trying to select any

entry from that dropdown using touch or dpad, it is not showing any
focus on it, so what can

be problem in that?? My code is as under. Thanks.

Custom view adapter code regarding to UI:

public class ContactListAdapter extends ResourceCursorAdapter {
    private ContentResolver mContent;
    public static String[] projection = { People._ID, People.NAME,
People.NUMBER };

    public ContactListAdapter(Context context, Cursor c) {
        super(context, R.layout.auto_complete, c);
        mContent = context.getContentResolver();
    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {
        TextView name = (TextView) view.findViewById(R.id.AutoName);
        name.setText(cursor.getString(1));
        TextView number = (TextView) view.findViewById
(R.id.AutoContact);
        number.setText(cursor.getString(2));
        //view.setFocusableInTouchMode(true);
/*        view.setOnTouchListener(new OnTouchListener(){

                        @Override
                        public boolean onTouch(View v, MotionEvent event) {
                                v.setSelected(true);
                                return false;
                        }

        });*/
    }

.xml file
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#ffffff"
    android:padding="3dp"
    >

    <TextView
        android:id="@+id/AutoName"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:singleLine="true"
        />

    <TextView
        android:id="@+id/AutoContact"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:singleLine="true"
        />
</LinearLayout>

code for setting adapter to autocompletetextview:
Cursor contactListCursor =
                managedQuery(Contacts.People.CONTENT_URI,
                    ContactListAdapter.projection, null, null,
People.NAME);

            ContactListAdapter contact =
                new ContactListAdapter(this,
contactListCursor);
            txtToContact.setAdapter(contact);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to