解析R.java类 [英] parse R.java class

查看:132
本文介绍了解析R.java类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在一个活动的时候,我怎么能得到死R.java类的完整code解析呢?
我想分析的资源字符串。

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.

在我的R舱有以下条目:

In my R class there's the following entry:

public static int abs__home=0x7f04000a;

我要搜索R.java的字符串abs__home整个文本。我真的需要搜索的字符串。

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

推荐答案

使用则getIdentifier()

Use getIdentifier()

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

如果在名称 abs__home )不会的资源内退出时,你会得到 0

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

这篇关于解析R.java类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆