《android---获取值AndroidManifest.xml中meta-data的value》

[java] view plaincopyprint?
//在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");


你可能感兴趣的:(android,meta-data)