android:getIdentifier——获取资源Id

public int getIdentifier (String name, String defType, String defPackage)

name:文件的名称

defType:文件的类型,也就是res目录下资源所在文件夹的名称

这里资源路径是res/raw/androidpn.properties,defType参数就是传入"raw"

defPackage:项目的包名

int id = context.getResources().getIdentifier("androidpn", "raw",
                    context.getPackageName());
//加载properties文件
props.load(context.getResources().openRawResource(id));
 
原文地址:https://www.cnblogs.com/fengbeihong/p/2673648.html