android - ListView Button does not update background properly -


i have listview , has layout utilizes imagebutton (btnadd).

the problem having when press imagebutton within layout populated in listview imagebutton supposed change background grey green.

this operation works properly, when there mulitple items in listview imagebutton background changes on bottom listview item , not listview's imagebutton clicked.

what missing? should referencing item's position within listview?

@override     public view getitemview(final parseuser puser, view v, viewgroup parent) {          if (v == null) {             v = view.inflate(getcontext(), r.layout.search_detail, null);         }          super.getitemview(puser, v, parent);          parseimageview todoimage = (parseimageview) v                 .findviewbyid(r.id.imageviewsearch);         parsefile imagefile = puser.getparsefile("photo");         if (imagefile != null) {             todoimage.setparsefile(imagefile);             todoimage.loadinbackground();         }          // add title view         final textview titletextview = (textview) v                 .findviewbyid(r.id.textviewsearch);         titletextview.settext(puser.getusername());          btnadd = (imagebutton) v.findviewbyid(r.id.imagebuttonadd);         btnadd.setonclicklistener(new view.onclicklistener() {             public void onclick(view v) {                 // perform action on click                 drawable background = v.getresources().getdrawable(                         r.drawable.ui_border_green);                 drawable img = v.getresources().getdrawable(                         r.drawable.ico_friend_add_green);                  btnadd.setbackground(background);                 btnadd.setimagedrawable(img); 


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -