1. Are you ready for the Galaxy S20? Here is everything we know so far!

change image on click!!

Discussion in 'Android Development' started by wounded, Aug 19, 2012.

  1. wounded

    wounded Newbie
    Thread Starter

    hi all ,
    hope all are fine
    i want to change image to another image or video by click ??!
    anybody know to help plz
     



    1. Download the Forums for Android™ app!


      Download

       
  2. jonbonazza

    jonbonazza Android Expert

    Code (Text):
    1.  
    2.  
    3. make your class implement View.OnClickListener, then override the following method as so.
    4. @Override
    5. public void onClick(View v) {
    6.  
    7.     if (v == myButton)
    8.         imageView.setImageResource(R.drawable.my_resource);
    9. }
    10.  
     
  3. wounded

    wounded Newbie
    Thread Starter

    yeah ,thank you
     
Loading...

Share This Page

Loading...