Wednesday, March 30, 2011

Re: [android-developers] Changing ImageView's image

setImageResource() or similar methods:

http://developer.android.com/reference/android/widget/ImageView.html

On Wed, Mar 30, 2011 at 7:01 AM, Raghav Sood <raghavsood@gmail.com> 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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment