Select All Text in an EditText on Focus

How to Select All Text in an EditText on Focus

added in API Level 1

If text is selectable, select it all when the view takes focus.
(TextView: Doesn't seem to work for a TextView. )

1. Create an Android project, if you don't already have one.

2. Add an EditText in the main.xml file.

3. In the main.xml file, add the code below.

<EditText
        ...
android:selectAllOnFocus = "true"
/>

4. Compile and run!

Related Articles:

Resources:
http://developer.android.com/reference/android/widget/TextView.html#attr_android:selectAllOnFocus
http://developer.android.com/reference/android/R.attr.html#selectAllOnFocus