change image on click!!

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

  1. wounded

    wounded Active Member
    15

    Jul 27, 2012
    35
    0
    15
    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
    163

    Jul 13, 2010
    1,934
    458
    163
    Male
    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
    15

    Jul 27, 2012
    35
    0
    15
    yeah ,thank you
     

Share This Page

Loading...