Android imagebutton toogle click -
i have imagebutton , want write setonclicklistener method toggle click(like togglebutton).i know how working togglebutton not need use it.it possible write toggleclick method in imagebutton.i wrote code not woking such togglebutton
strada_chart.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { if(arg0.isclickable()==true) { toast.maketext(getapplicationcontext(), "1", toast.length_short).show(); } else { toast.maketext(getapplicationcontext(), "2", toast.length_short).show(); } } });
try this..
like_btn.setonclicklistener(new onclicklistener() { public void onclick(view v) { if(fun) { like_btn.setimageresource(r.drawable.unlike); fun=false; } else { fun=true; like_btn.setimageresource(r.drawable.like); toast.maketext(getapplicationcontext(), "changed", toast.length_long).show(); } } });
Comments
Post a Comment