1. When you say, "Suppose my strings.xml file has following", and there's a "Hello world!", it would mean your strings.xml
would look like:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello_world">Hello world!</string>
</resources>
This means there are strings defined under Resources of your app which can be used by importing yourpackage.R
- that is how the compiler will identify values from R
.
So what is the name of the string which has value "Hello world!" in your xml?
2. To get that value, you would use:
getResources.getString(R.string.stringNameHere);
3. And as per your requirement, i suggest you get all strings
from your strings.xml
in an array and run your search through that.
To know more about all that, please go through:
-> http://developer.android.com/guide/topics/resources/string-resource.html
-> https://developer.android.com/samples/BasicNetworking/res/values/strings.html
-> Organizing Strings.xml