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. hi Friends i want to add Button

Hi Friends i Want to add Button. So i written xml code but following
error occur. and new xml file is not creater i use eclipse for develop
application. so sent me idea about this queries.

xml code and error

              <button
        android:id="@+id/button_normal"
        android:text="@string/buttons_1_normal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ></button>

Error like "No Resources found that matches the given name (at "text"
with  value' ="@+id/button_normal'

This error occur at <button possition
--~--~---------~--~----~------------~-------~--~----~

2. how to set scroll view

hi all i want to set scroll view in my progame but their was one error
that grid view dosent contain unspecified size .
here is my code
<?xml version="1.0" encoding="utf-8"?>

<AbsoluteLayout
        android:id ="@+id/layout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
         xmlns:android="http://schemas.android.com/apk/res/android"
        android:background="#ff670202"
<GridView
        android:id ="@+id/griddd"
        android:layout_width ="fill_parent"
        android:layout_height= "wrap_content"
        android:padding ="10dip"
        android:verticalSpacing="10"
        android:numColumns ="4"
        android:columnWidth="30"
        android:layout_x="0px"
        android:layout_y="20px"
        />
<ListView android:id="@+id/android:list"
                         android:layout_width="fill_parent"
                         android:layout_height="fill_parent"
                         android:drawSelectorOnTop="false"
                         android:layout_x="0px"
             android:layout_y="140px"

         />


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

3. How to deploy a new android application

4. an android bug?

5. A cheap ($150) android development platform?

6. Cannot use Lucene with Android

7. Error in HelloAndroid: Could not find /bin/HelloAndroid.apk!