I want to select all the text present in the EditText field, if one clicks on the same one, right now I can achieve this by specifying the code below in android 2.x and 3.x, but not in 4.0. If anyone had the same problem, please let me know how to solve this problem.
@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;
}
}
source
share