android中获取AndroidManifest.xml中的MetaData标签值
2016-09-06 18:26
459 查看
private String getMetaDataValue(String name, String def) { String value = getMetaDataValue(name); return (value == null) ? def : value; } private String getMetaDataValue(String name) { Object value = null; PackageManager packageManager = context.getPackageManager(); ApplicationInfo applicationInfo; try { applicationInfo = packageManager.getApplicationInfo(context .getPackageName(), 128); if (applicationInfo != null && applicationInfo.metaData != null) { value = applicationInfo.metaData.get(name); } } catch (NameNotFoundException e) { throw new RuntimeException( "Could not read the name in the manifest file.", e); } if (value == null) { throw new RuntimeException("The name '" + name + "' is not defined in the manifest file's meta data."); } return value.toString(); }
相关文章推荐
- Android 获取AndroidManifest.xml文件versionCode,versionName属性
- Android APK反编译方法(可以获取APK xml和android Manifest,java代码等内容)
- AndroidManifest.xml中的<application标签中的android:name属性介绍
- [整理] AndroidManifest.xml 标签
- android 教你怎么获取AndroidManifest.xml文件中的meta-data数据
- Android 获取AndroidManifest.xml文件versionCode,versionName属性 .
- Android APK反编译方法(可以获取APK xml和android Manifest,java代码等内容)
- Android 通过包名获取AndroidManifest.xml,res,assets下的资源
- 从AndroidManifest.xml中获取已注册Activity的方法
- 获取AndroidManifest.xml中<meta-data>元素
- Android 获取AndroidManifest.xml文件versionCode,versionName属性
- Android APK反编译方法(可以获取APK xml和android Manifest,java代码等内容)
- JAVA使用AXMLPrinter获取APK中Androidmanifest.xml信息
- AndroidManifest.XML文件功能、元素、标签汇总
- android manifest.xml 标签汇总
- Android 获取AndroidManifest.xml文件versionCode,versionName属性
- android获取AndroidManifest.xml文件中versionCode,versionName值
- Android系统开发 - 扩展Androidmanifest.xml文件中<application>标签的属性
- AndroidManifest.xml 标签含义字典
- Android获取包名,版本号,以及AndroidManifest.xml不同元素下的 <meta-data>的值