本文整理了Java中android.content.Context.getPackageResourcePath()
方法的一些代码示例,展示了Context.getPackageResourcePath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.getPackageResourcePath()
方法的具体详情如下:
包路径:android.content.Context
类名称:Context
方法名:getPackageResourcePath
暂无
代码示例来源:origin: oasisfeng/condom
@Override public String getPackageResourcePath() {
return mBase.getPackageResourcePath();
}
代码示例来源:origin: Trumeet/MiPushFramework
@Override public String getPackageResourcePath() {
return mBase.getPackageResourcePath();
}
代码示例来源:origin: iReaderAndroid/ZeusPlugin
AssetManager assetManager = AssetManager.class.newInstance();
Method addAssetPath = AssetManager.class.getMethod("addAssetPath", String.class);
addAssetPath.invoke(assetManager, mBaseContext.getPackageResourcePath());
代码示例来源:origin: HIFILEO/ReactiveArchitecture
/**
* Return the contents of the file with the provided fileName from the test resource directory.
*
* @param context - The Context to use when loading the resource.
* @param fileName - The name of the file in the test resource directory.
* @return The contents of the file with the provided fileName from the test resource directory.
* @throws Exception if something goes wrong.
*/
public static String getFileContentsAsString(Context context, String fileName) throws Exception {
String filePath = context.getPackageResourcePath() + RESOURCE_PATH + fileName;
File jsonFile = new File(filePath);
FileInputStream inputStream = new FileInputStream(jsonFile);
StringBuilder contents = new StringBuilder();
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = br.readLine()) != null) {
contents.append(line);
}
return contents.toString();
}
代码示例来源:origin: stackoverflow.com
String apkPath = context.getPackageResourcePath();
Log.d("SharedLibraryLoader", String.format("Path to Package resource is: %s", apkPath));
内容来源于网络,如有侵权,请联系作者删除!