change image on click!!


Last Updated:

  1. wounded

    wounded Active Member This Topic's Starter

    Joined:
    Jul 27, 2012
    Messages:
    35
    Likes Received:
    0
    hi all ,
    hope all are fine
    i want to change image to another image or video by click ??!
    anybody know to help plz
     

    Advertisement
  2. jonbonazza

    jonbonazza Well-Known Member

    Joined:
    Jul 13, 2010
    Messages:
    1,934
    Likes Received:
    458
    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 Active Member This Topic's Starter

    Joined:
    Jul 27, 2012
    Messages:
    35
    Likes Received:
    0
    yeah ,thank you
     

Share This Page

Loading...