android - ListView OnLongClickListener doesn't works -


i wanna change background color of listview, doesn't work listener onlongclicklistener.

the listener onitemlongclicklistener works why onlongclicklistener no?

code:

@override public view oncreateview(layoutinflater inflater, viewgroup container,                          bundle savedinstancestate) {     /*         etc..     */     listview lv = (listview)ret.findviewbyid(r.id.lun_list);     lv.setadapter(oa);     lv.setbackgroundcolor(color.black);      lv.setonitemlongclicklistener(new adapterview.onitemlongclicklistener() {         @override         public boolean onitemlongclick(adapterview<?> adapterview, view view, int i, long l) {             showpopup();             return false;         }     });     lv.setonlongclicklistener(new view.onlongclicklistener() {         @override         public boolean onlongclick(view view) {             showtest();             return false;         }     });      return ret; } private void showtest(){     fragmentmanager fragmentmanager = getactivity().getsupportfragmentmanager();     getview().findviewbyid(r.id.lun_list).setbackgroundcolor(color.yellow); } 

have added following attribute list view handle onlongclicklistener please set android:longclickable="true"


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -