how to change the background or the image source when a clickable imageview in android is clicked? -


i set android:clickable="true" imageview in android app. want change background or image source when clicked, how that?

try this:

myimageview.setonclicklistener(myonclickhandler); 

and write handler like:

onclicklistener myonclickhandler = new onclicklistener() {     @override     public void onclick(view v) {                  myimageview.setimageresource(r.id.imageview1);                  myimageview.setbackgroundresource(r.id.imageview2);                  //myimageview.setimagebitmap(bm);                  //myimageview.setimagedrawable(r.drawable.image1);     } }; 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -