Android examples for App:Resource
get Resource Id
//package com.java2s; import android.content.Context; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Resources; public class Main { public static int getResourceId(Context context, String name, String type, String packageName) { Resources themeResources = null; PackageManager pm = context.getPackageManager(); try {/*from w w w .j a va 2 s .c o m*/ themeResources = pm.getResourcesForApplication(packageName); return themeResources.getIdentifier(name, type, packageName); } catch (NameNotFoundException e) { e.printStackTrace(); } return 0; } }