i want have favorite button on app in gmail
so, when user click on star, star became yellow, , when user clicked again, turn normal
how can make happen custom image? have 2 images
when not favorited (heart-grey.png) , when favorited (heart-red.png)
if star imagebutton can :
starselected.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { //add condition detect if favorite or not if(starselected.getdrawable() == r.drawable.theimage2) { starselected.setimageresource(r.drawable.thenewimage); }else{ starselected.setimageresource(r.drawable.thenewimage2); } } });
hope helps
Comments
Post a Comment