android: Listview is not clickable on version greater than 3.0? -
i displaying list in apps. when user can click on list send next activity. list displayed list clickable on version less 3.0 , not clickable on version greater 3.0. don't understand wrong. i'm using listfragment displaying list , override method onlistitemclick. tried solution on stackoverflow not achive goal. please have solution.
following onlistitemclick method listfragment.
@override public void onlistitemclick(listview l, view v, int position, long id) { // todo auto-generated method stub super.onlistitemclick(l, v, position, id); l.setonitemclicklistener(new android.widget.adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> arg0, view view, int arg2, long arg3) { intent href = new intent(getsherlockactivity(), projectdetailactivity.class); string projid = ((textview) view.findviewbyid(r.id.projectid)).gettext().tostring(); string projname = ((textview) view.findviewbyid(r.id.projectname)).gettext().tostring(); log.v("in itemclicklistener", "click"+((textview) view.findviewbyid(r.id.projectid)).gettext().tostring()); getsherlockactivity().startactivity(href); } }); }
following listview.xml
<listview android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginleft="1dp" android:divider="@drawable/divider" android:smoothscrollbar="true" android:dividerheight="1dp" android:scrollbarthumbvertical="@drawable/divider" android:drawselectorontop="false" android:listselector="@drawable/list_selector" android:clickable="true" > </listview>
i think following way enough.
listview.setonitemclicklistener(new onitemclicklistener() { public void onitemclick(adapterview<?> arg0, view arg1, int arg2,long arg3) { // todo auto-generated method stub } });
remove onlistitemclick()
method , write way in oncreate()
method itself.
i hope you.
Comments
Post a Comment