2
我有一个应用程序'A'和应用程序'B'。如何从另一个应用程序访问字符串资源
说,我在申请“A”
<\string name="abc">ABCDEF<\/string>
如何访问从活动中的“B” ABC值的字符串资源。
我试过以下方法。
try {
PackageManager pm = getPackageManager();
ComponentName component = new ComponentName(
"com.android.myhome",
"com.android.myhome.WebPortalActivity");
ActivityInfo activityInfo = pm.getActivityInfo(component, 0);
Resources res = pm.getResourcesForApplication(activityInfo.applicationInfo);
int resId = res.getIdentifier("abc", "string", null);
}
catch(NameNotFoundException e){
}
始终渣油则返回0总是..任何人都可以请让我知道,如果我可以从应用程序“B”
问候, SANAT