Get meta data from AndroidManifest.xml
Meta data
In AndroidManifest.xml, you can define meta data
<meta-data android:name="com.atmarkplant.key" android:value="Hello" />
How to get using code
String key = "";
try {
ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(
context.getPackageName(), PackageManager.GET_META_DATA);
if (appInfo.metaData != null) {
key = appInfo.metaData.getString("com.atmarkplant.key");
}
}
catch (PackageManager.NameNotFoundException oops) {
oops.printStackTrace();
}
You need context from anywhere.
And the argument is name.
