android:text - Display Text in a TextView/EditText

How to Display Text in a TextView/EditText

android:text was added in API Level 1

Set text to display.

1. Add a TextView in the main.xml file.

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

<TextView
        ...
       android:text = "This text will display."
/>

3. Compile and run!

4. Instead of hard coded text, you can link the text to the string.xml file, as below. Where hello is the name of the string to display.

android:text = "@string/hello"

Next Recommended Article: android:id - How to Name a TextView

Resources:
http://developer.android.com/reference/android/widget/TextView.html#attr_android:text
http://developer.android.com/reference/android/R.atr.html#text