This changes the focus of the EditText when the button is clicked:
public class MainActivity extends Activity {
private EditText e1,e2;
private Button b1,b2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
e1=(EditText) findViewById(R.id.editText1);
e2=(EditText) findViewById(R.id.editText2);
e1.requestFocus();
b1=(Button) findViewById(R.id.one);
b2=(Button) findViewById(R.id.two);
b1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
e1.requestFocus();
}
});
b2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
e2.requestFocus();
}
});
}
}