Hi, this works for me: new Handler().post(new Runnable() { @Override public void run() { paidView.selectAll(); } });
On Thursday, February 2, 2012 5:12:54 AM UTC+1, Michel Stéphane Bruno wrote: > > Hi, > > I am trying to programmatically select all the text in an EditText field > when a user touches the field so that when the user starts typing it > replaces the existing text (I cannot use settings in the XML file because > this field is programmatically added to the screen). To do this, I attached > an OnFocusChangeListener to the EditText field. The onFocusChange method > is below: > > @Override > > public void onFocusChange(View v, boolean hasFocus) { > > EditText editText = (EditText) v; > if (hasFocus) editText.selectAll(); > > } > > This works fine on Android 2.x, but it does not work in ICS. After > touching the EditText field, the cursor just sits in the begin of the field > and the text is not selected. Is it a bug? Is there a workaround? > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en