Monday, August 15, 2011

[android-developers] Clickable ImageView

I have an application which implements a clickable image view, however, when i add the following code:

team_background = (ImageView) findViewById(R.id.home_background);

team_background.setClickable(true);

team_background.setOnClickListener(new View.OnClickListener() {

   @Override
   public void onClick(View v) {
// TODO Auto-generated method stub
   }
});

<xml>

<ImageView
    android:id="@+id/team_background"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>

The program crashes. Only on the setOnClickListener, which works fine for my text views and buttons etc... Can someone help to identify the problem here?
Thanks ~Matt

--
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