标签:android style blog http color io java ar div
转自: http://www.2cto.com/kf/201303/194824.html
android 开发中:
<activity...> <meta-data android:name="data_Name" android:value="hello my activity"></meta-data> </activity>
ActivityInfo info=this.getPackageManager() .getActivityInfo(getComponentName(), PackageManager.GET_META_DATA); String msg =info.metaData.getString("data_Name"); Log.d(TAG, " msg == " + msg );
<application...> <meta-data android:value="hello my application" android:name="data_Name"></meta-data> </application>
ApplicationInfo appInfo = this.getPackageManager() .getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA); String msg=appInfo.metaData.getString("data_Name"); Log.d(TAG, " msg == " + msg );
<service android:name="MetaDataService"> <meta-data android:value="hello my service" android:name="data_Name"></meta-data> </service>
ComponentName cn=new ComponentName(this, MetaDataService.class); ServiceInfo info=this.getPackageManager() .getServiceInfo(cn, PackageManager.GET_META_DATA); String msg=info.metaData.getString("data_Name"); Log.d(TAG, " msg == " + msg );
<receiver android:name="MetaDataReceiver"> <meta-data android:value="hello my receiver" android:name="data_Name"></meta-data> <intent-filter> <action android:name="android.intent.action.PHONE_STATE"></action> </intent-filter> </receiver>
ComponentName cn=new ComponentName(context, MetaDataReceiver.class); ActivityInfo info=context.getPackageManager() .getReceiverInfo(cn, PackageManager.GET_META_DATA); String msg=info.metaData.getString("data_Name"); Log.d(TAG, " msg == " + msg );
[转] Android获取Manifest中<meta-data>元素的值
标签:android style blog http color io java ar div
原文地址:http://www.cnblogs.com/kangyi/p/3958248.html