Sunday, 15 September 2013

Edittext field next defers to itself

Edittext field next defers to itself

I'm trying to make it so if a user selects an edittext box, it clears it.
Now through trying to do this, it appears that hitting next still keeps
the focus in the same text box and clears it. I tried
rows = (EditText) findViewById(R.id.editText1);
cols = (EditText) findViewById(R.id.editText2);
ticks = (EditText) findViewById(R.id.editText3);
rows.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
rows.setText("");
//cols.requestFocus();
}
});
cols.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
cols.setText("");
//ticks.requestFocus();
}
});
ticks.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ticks.setText("");
}
});
now i tried doing request focus in the onclick, which successfully moves
the focus to the the next edittext, but it clears what was in the previous
edittext as it does that. How can I make the edittexts clear the text when
a user selects it, yet still retain it's normal "next" properties.

No comments:

Post a Comment