android - OnItemClickListener on a ListView inside a Fragment not working -
edit: solved. if there's focusable in xml of items, break touch of list, in other words, android:focusable=false checkboxes, switches or of ur list. , done =)
ok so, here's problem.
i wrote app uses tabs , fragments, , goes way want except thing when seek capture onitemclick on listview it not mark row touched/pressed/selected.
i've been reading little bit , many people have same issue, did not found responses helped me @ all.
i don't want implement listfragment, in fact don't know how/why should, , since code working, don't know if implementing 1 give me much more work do, so, here is:
is possible implement listener click on listview, within fragment? , if is, how?
pd: minsdk=14, tatgetsdk=15
here's code snippet that'll want. listview lv; //code listview instance using findviewbyid etc lv.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> arg0, view arg1,int position, long arg3) { toast.maketext(enclosingactivity.this, "stop clicking me", toast.length_short).show(); } });
people trip on this, see if have got covered:
all clicks , phone call backs (eg: menu/actionbar callbacks) sent activity fragment bound to, must in activity class , not fragment class.
android listview fragment onclicklistener
No comments:
Post a Comment