根据传入的字符串跳转Activity
1 2 | Intent intent = new Intent(context,Class.forName( "com.packname.Activity" )); startActivity(intent); |
根据传入的字符加载资源
1 2 | int icon = getResources().getIdentifier(“imageid”, "drawable" , getPackageName()); |
getIdentifier的函数签名如下:
public int getIdentifier (String name, String defType, String defPackage)