package example.imagebutton;

import example.imagebutton.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
//import android.widget.Toast;
import android.view.View;
import android.view.View.OnClickListener;
 
public class MainActivity extends Activity {
 
	ImageButton imageButton;
	Button resetButton;
	TextView message;
 
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		addListenerOnButton();
	}
 
	public void addListenerOnButton() {
 
		imageButton = (ImageButton) findViewById(R.id.imageButton1);
        resetButton = (Button) findViewById(R.id.resetButton);
		imageButton.setOnClickListener(new OnClickListener() {
 
			@Override
			public void onClick(View view) {
 
			   message = (TextView) findViewById(R.id.message);
//			   Toast.makeText(MainActivity.this,
//				"Image Button clicked!", Toast.LENGTH_SHORT).show();
			   message.setText("Image Button Clicked!");
			}
 
		});

		resetButton.setOnClickListener(new OnClickListener() {
			 
			@Override
			public void onClick(View view) {
 
			   message = (TextView) findViewById(R.id.message);
			   message.setText(" ");
			}
 
		});
	}
 
}