XML Method Example for a Button: TextView myOut; EditText myText; In onCreate: myText = (EditText) findViewById(R.id.editText); myOut = (TextView) findViewById(R.id.output); New Method: public void calculate(View view) { myOut.setText(myText.getText().toString()); } OnClickListener Example for a button: import android.widget.Button; import android.widget.ImageView; import android.view.View; import android.view.View.OnClickListener; int counter; Button button; ImageView image; image = (ImageView) findViewById(R.id.imageView1); button.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { if (counter == 1) { image.setImageResource(R.drawable.frog); counter--; } else { image.setImageResource(R.drawable.pig); counter++; } } });