Android Image Button Listener

This is part of the Android Quick Code Access series of posts. For more information on handling Buttons, see the Android Button class.

// Listener for Button.
ImageButton imageButton = (ImageButton) findViewById(R.id.myButton);
imageButton.setOnClickListener(new OnClickListener() {
			
    // Button onClick method.
    @Override
    public void onClick(View v) {
				
        // Take action here.
         . . .

    } 
});