Android listview can not listen on selected item -


i met problem can not listen on single item selection listview. here xml layout structure page.

relativelayout     linearlayout         searchtext         searchbutton     linearlayout         list 

below code how fetch data text , how set listener list view.

private void searchaction() {     textview searchtext = (textview)findviewbyid(r.id.searchtext);      string username = searchtext.gettext().tostring();      searchtext.clearfocus();     adapter = new simplecursoradapter(this,              r.layout.search_list_item,              null,              new string[]{},               new int[]{},             0);     adapter.setviewbinder(new simplecursoradapter.viewbinder() {          @override         public boolean setviewvalue(view view, cursor cursor, int columnindex) {             switch(view.getid()) {             // here can add 1 more line in main page each account             return false;         }     });      listview.setadapter(adapter);     listview.requestfocus();      listview.setonitemlongclicklistener(new adapterview.onitemlongclicklistener() {          public boolean onitemlongclick(adapterview<?> arg0, view v, int index, long id) {              //string str=listview.getitematposition(index).tostring();              toast.maketext(getbasecontext(), "index: "+index + "id: "+id, toast.length_long).show();              return true;         }     });     listview.setitemscanfocus(true); } 

i able fetch data textview. listener set listview not work. accepted. thank

this way tried happens when long click on each row of list not it's children.
should implement onclicklistener in adapter class managing clicks on each child.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -