I want to select all the text present in EditText field if one clicks on the same, right now i can achieve this by below code in android 2.x and 3.x but not in 4.0. If any one had the same problem please let me know how to resolve this.
@Override
public void onFocusChange(View v, boolean hasFocus) {
switch(v.getId()) {
case R.id.passcodetext1:
if(hasFocus) editText1.selectAll();
break;
case R.id.passcodetext2:
if(hasFocus) editText2.selectAll();
break;
case R.id.passcodetext3:
if(hasFocus) editText3.selectAll();
break;
case R.id.passcodetext4:
if(hasFocus) editText4.selectAll();
break;
}
}
I solved this by just adding one property in layout.xml.
Earlier i was not aware of this but this is really a very good solution for this kind of problems.