How to place focus in child view of list row?

by Oleksiy Kokachev » Fri, 13 Mar 2009 01:42:35 GMT


Sponsored Links
 Hi..
I have ListView, where each row contains two edittext boxes. I'd like
on list item selected(using Dpad) place focus on first edittext box. I
tried the following code, but it does not work:
ListView list = (ListView) findViewById(R.id.list);
OnItemClickListener click_listener = new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view, int
position, long id){
                        EditText box1 = (EditText)view.findViewById(R.id.box1);
                        box1.requestFocus();
                    return ;
                }

        };
        list.setOnItemClickListener(click_listener);
}

Any help is appreciated.

Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~



How to place focus in child view of list row?

by Oleksiy Kokachev » Fri, 13 Mar 2009 01:42:56 GMT


 Hi..
I have ListView, where each row contains two edittext boxes. I'd like
on list item selected(using Dpad) place focus on first edittext box. I
tried the following code, but it does not work:
ListView list = (ListView) findViewById(R.id.list);
OnItemClickListener click_listener = new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view, int
position, long id){
                        EditText box1 = (EditText)view.findViewById(R.id.box1);
                        box1.requestFocus();
                    return ;
                }

        };
        list.setOnItemClickListener(click_listener);
}

Any help is appreciated.

Thanks in advance.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. ContentResolver update() issues

Anyone else have problem with update() in ContentResolver?

I have some extremely simple code--I just want to update the PHOTO
column of the People content provider.

        private void updatePhoto(int id, String uri)
        {
                ContentValues cv = new ContentValues();
                cv.put(People.PHOTO, uri);
                int x = 
getContentResolver().update(People.CONTENT_URI,cv,People._ID
+"="+id, null);
                Log.d("PhotoUpdater",x+" row(s) updated.");
        }

       public void onCreate(Bundle icicle) {
               super.onCreate(icicle);
               updatePhoto(14,"http://www.homepage.com/brandon.jpg");
      }

I am 100% confident I have a contact with ID 14, so why is my row not
updated??  Bug??

James

--~--~---------~--~----~------------~-------~--~----~

2. Data type issue in Andriod

Hi,
I created a table which had a column with timestamp data type.
However, I can not insert records into the table because put method in
ContentValues class does not accept timestamp data type.
Are there any ways to work around.

Thanks,
Senshan

--~--~---------~--~----~------------~-------~--~----~

3. Industry Standard article on deciding which mobile platform to develop for

4. Android Native Code Cross Dev With Latest CodeSourcery Toolchain

5. Is there a roadmap?

6. Write an Android book -- Packt Publishing is looking for authors

7. Looking for UML for Android