I try to set the focus on ListView but onItemSelected – not work, here is my source
uAdapter = new UrlArrayAdapter(DatabaseTable.this, urlListView,
urlLists);
urlListView.setAdapter(uAdapter);
urlListView.setItemsCanFocus(true);
urlListView.setClickable(false);
urlListView.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> arg0, View arg1, int pos,
long id) { });
I use the following XML. My LisWiev xml
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:descendantFocusability="beforeDescendants" >
</ListView>
and an item xml which add to the ListView
<LinearLayout
android:id="@+id/editLinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minHeight="50dp" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.66"
android:ems="10" >
<requestFocus />
</EditText>
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false" />
</LinearLayout>
I solved the problem, helped me this article, it is shown how to use the ListView
[Linc] (http://www.lalit3686.blogspot.in/2012/06/today-i-am-going-to-show-how-to-deal.html)
and Helped me to this link
http://vikaskanani.wordpress.com/2011/07/27/android-focusable-edittext-inside-listview/
Your onItemSelected is not being called, since you have set the
setClickableattibute of your list to false. Try changing it to true and then check out. I hope that will work.