Hi Mark,

Thanks. I have already tried that. The code I used was:
button.setImageResource(Drawable m1s.png);

That  didn't work. Is there something wrong or am i using the wrong part of
the api.

On Wed, Mar 30, 2011 at 4:52 PM, Mark Murphy <[email protected]>wrote:

> setImageResource() or similar methods:
>
> http://developer.android.com/reference/android/widget/ImageView.html
>
> On Wed, Mar 30, 2011 at 7:01 AM, Raghav Sood <[email protected]> wrote:
> > Hi everyone,
> >
> > I have an ImageView who's image I need to chenge on touch.The ImageView's
> > src is set through XML. My code is as follows:
> >
> > public class abc extends Activity {
> >     // Create an anonymous implementation of OnClickListener
> >     private OnClickListener match1 = new OnClickListener() {
> >         public void onClick(View v) {
> >
> >         };
> >
> >     /** Called when the activity is first created. */
> >     @Override
> >     public void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
> >         setContentView(R.layout.main);
> >         ImageView button = (ImageView)findViewById(R.id.l1m1);
> >         // Register the onClick listener with the implementation above
> >         button.setOnClickListener(match1);
> >
> >     }
> >
> >
> > }
> >
> > What do I put in the onclick event to change the ImageView's image?
> >
> > Thanks
> >
> > --
> > Raghav Sood
> > http://www.raghavsood.com/
> > http://www.androidappcheck.com/
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> > http://groups.google.com/group/android-developers?hl=en
>
>
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to *Advanced* Android Development_ Version
> 1.9.2 Available!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
Raghav Sood
http://www.raghavsood.com/
http://www.androidappcheck.com/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to