Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android如何获取manifest中配置的meta-data? #2

Open
supengchao opened this issue Feb 24, 2016 · 0 comments
Open

android如何获取manifest中配置的meta-data? #2

supengchao opened this issue Feb 24, 2016 · 0 comments

Comments

@supengchao
Copy link
Owner

如果想要获取Manifest中配置的meta-data数据,通过系统的applicationInfo类api获取,具体的代码如下:
1、清单文件中配置如下:

2、获取PackageManager 类
PackageManager packageManager = context.getPackageManager();
3、获取applicationInfo类
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(context.getPackageName(),PackageManager.GET_META_DATA);
4、获取值
if (applicationInfo != null && applicationInfo .metaData != null)
{
name= (int) applicationInfo .metaData.get(“name”);

        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant