0

I need to know if there is a way to get String type data from strings.xml (nested in resource tag)

<resources>
    <string name="app_name">One World</string>
    <string name="action_settings">Settings</string>
    <string name="hello_world">Hello world!</string>
    <string name="productInfo_lanIP">LAN IP Address :\t</string>
</resources>

and I need to get productInfo_lanIP from this and use it in my MainActivity.java to perform insertion of another string into this one.

Note: I am updating the value so I can use it to display it just after through an XML page. And I am using Android 4.2.2

2 Answers 2

1

you can get the strings like:

 String productInfo_lanIP = getString(R.string.productInfo_lanIP);

go through this link

Sign up to request clarification or add additional context in comments.

1 Comment

Ok I got it its working but I also need to update this value in the strings.xml file. How can I do that?
0
String mystring = getResources().getString(R.string.productInfo_lanIP);

Accept the answer if it helped you :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.