I want to select text (not all) when user clicks on it.
final EditText field = (EditText) findViewById(R.id.edittext); field.setText("BlaBlaBlaBlaBlaBlaBlaBlaBla"); field.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { field.setSelection(0, 10); } } }); But text isn't selected. The cursor appears at the point of click.
How can I do this?
Updated:
Why simple method setSelection(start, end) in "Hello World" app doesn't work?