views:

271

answers:

1

Is it possible to add a click event to an ImageButton?
In my code its not working here is my code:

imagebutton1.setOnClickListener(new OnClickListener() {
   public void onClick(View v) { 
           Intent myIntent = new Intent(v.getContext(),FaceBook.class);
           startActivityForResult(myIntent, 37);
   }
});
A: 

Yes, it is possible. Here is a sample project demonstrating a View.OnClickListener applied to an ImageButton.

CommonsWare