-
I want to Call it in TextView
<string name="Std_Name">Name: Muhammad Abdullah</string> <string name="Std_Phone">Phone: +923338157028</string>
Question posted in Android Studio
The official documentation can be found here.
The official documentation can be found here.
4
Answers
Try this
From within an XML layout, you can use the
@string/resourceName
syntax within thetext
string to reference a string resource:Using the
Std_Name
string resource from your example, that would look something like this:Official documentation for string resources can be found here. You can also find a good example in the Accessing resources from XML section of the App resources overview.
Call in your Textview text field
If you want to add the value from strings.xml to
TextView
inmainactivity.xml
, add the following line of code to your xmlOr, if you want to add text from
strings.xml
to textview fromMainActivity.java
, add the following code