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));

 

 

 

posted @ 2012-09-06 16:05  韶纥  阅读(2996)  评论(1编辑  收藏  举报