How to access Android OS private strings programmatically?

Background

I would like to get all the lines of the Android OS (including all of them) programmatically, including those that are considered closed.

For example, I would like to get those from the packageManager application that I found here .

Problem

Using android.R.string returns only a small fraction of the lines.

What i tried

I found this link which shows the following code, but I'm not sure what to add to the parameters:

private String GetAttributeStringValue(Context context, AttributeSet attrs, String namespace, String name, String defaultValue) { //Get a reference to the Resources Resources res = context.getResources(); //Obtain a String from the attribute String stringValue = attrs.getAttributeValue(namespace, name); //If the String is null if(stringValue == null) { //set the return String to the default value, passed as a parameter stringValue = defaultValue; } //The String isn't null, so check if it starts with '@' and contains '@string/' else if( stringValue.length() > 1 && stringValue.charAt(0) == '@' && stringValue.contains("@string/") ) { //Get the integer identifier to the String resource final int id = res.getIdentifier(context.getPackageName() + ":" + stringValue.substring(1), null, null); //Decode the string from the obtained resource ID stringValue = res.getString(id); } //Return the string value return stringValue; } 

I also noticed an application called Android resources that does this, but only for some lines. It would also be nice to know other private resources.

Question

Is this possible? If not, is it possible to do this with root?

+6
source share
1 answer

Your link shows how to get resources from the settings screen and say:

  The goal of this example was to show how to obtain the correct String resource outside the Android XML namespace 

The link describes that you can get resources in an alternative way, not just R.string.

I am creating a demo project with a different user namespace and a custom shortcut button, but, unfortunately, I cannot show row resources from one project to another.

0
source

All Articles