Hello guys, i'm having a problem with this imageview listener (see
code below) well the click event is only triggered when I click on the
square00 item (this is ok) but on the onclick method that does the
action, i use the reference passed by the method and the action is
applied to all the imageviews on the Activity but I want the action to
be apllied only for the square00 imageview. Somebody knows what's
wrong?

public class HelloDroid extends Activity implements OnClickListener {
        /** Called when the activity is first created. */

        // Create an anonymous implementation of OnClickListener
        private OnClickListener mCorkyListener = new OnClickListener() {
            public void onClick(View v) {
              // do something when the button is clicked

                 ImageView asd = (ImageView)v;
                 asd.setAlpha(50);

            }
        };

        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);

        // Capture our img from layout
        ImageView img2 = (ImageView)findViewById(R.id.square00);
        // Register the onClick listener with the implementation above
        img2.setOnClickListener(mCorkyListener);
        }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to