You can use this
TextView output = (TextView) findViewById(R.id.output);
one.setOnClickListener(youractivity.this);
// set the onclicklistener for other buttons also
@Override
public void onClick(View v) {
int id = v.getId();
switch(id) {
case R.id.oneButton:
append("1",output);
break;
case R.id.twoButton:
append("2",output);
break;
case R.id.threeButton:
append("3",output);
break;
}
}
private void append(String s,TextView t){
t.setText(s);
}
you can identify the views in your activity in a separate method.