- //在Activity应用<meta-data>元素。
- ActivityInfo info = this.getPackageManager()
- .getActivityInfo(getComponentName(),PackageManager.GET_META_DATA);
- info.metaData.getString("meta_name");
- //在application应用<meta-data>元素。
- ApplicationInfo appInfo = this.getPackageManager()
- .getApplicationInfo(getPackageName(),PackageManager.GET_META_DATA);
- appInfo.metaData.getString("meta_name");
- //在service应用<meta-data>元素。
- ComponentName cn = new ComponentName(this, MetaDataService.class);
- ServiceInfo info = this.getPackageManager().getServiceInfo(cn, PackageManager.GET_META_DATA);
- info.metaData.getString("meta_name");
- //在receiver应用<meta-data>元素。
- ComponentName cn = new ComponentName(context, MetaDataReceiver.class);
- ActivityInfo info = context.getPackageManager().getReceiverInfo(cn, PackageManager.GET_META_DATA);
- info.metaData.getString("meta_name");
- FROM:http://blog.csdn.net/w695050167/article/details/25911433
《android---获取值AndroidManifest.xml中meta-data的value》
最新推荐文章于 2024-03-27 20:53:17 发布