parse R.java class

2019-09-22 01:35发布

When I'm in an activity, how can I get die complete code of the R.java class to parse it? I want to parse for a resource String.

In my R class there's the following entry:

public static int abs__home=0x7f04000a;

And I want to search the whole text of R.java for the String "abs__home". I really need to search for the string.

1条回答
Lonely孤独者°
2楼-- · 2019-09-22 01:56

Use getIdentifier()

int id = getResources().getIdentifier("abs__home", "string", getPackageName());

if the name (abs__home) does not exits inside the resources, you will get 0

查看更多
登录 后发表回答