listview - Android PopupMenu opening on wrong positions -


i have listview each item has button opens popupmenu options.

most of time, these menus open @ wrong positions (sometimes open on correct positions), these random opens not consistent.

clicked on blue test3

clicked on blue test1

choosing option in menu manipulate correct item on position tried open menu

my code:

settings.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {              popupmenu popup = new popupmenu(context, settings);             popup.getmenuinflater().inflate(r.menu.notes_menu, popup.getmenu());             popup.setonmenuitemclicklistener(new popupmenu.onmenuitemclicklistener() {                 public boolean onmenuitemclick(menuitem item) {                      string itemtitle = item.gettitle().tostring();                      switch (itemtitle) {                          case "add pictures":                               //adding pictures                          case "delete":                              //deleting                          case "share":                              //sharing                      }                      return true;                 }             });              popup.show();            }     }); 

this settings button located inside public view getview(final int position, view convertview, viewgroup parent) method of listview adapter.

any appreciated! ^^

create popup before setting onclicklistener , call popup.show() inside onclick().


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -