문제

I would like to change the value of a meta-data in the AndroidManifest.xml file :

I am using the following code :

ApplicationInfo applicationInfo = packageManager.getApplicationInfo(
                activity.getPackageName(), PackageManager.GET_META_DATA);
applicationInfo.metaData.putString("dataName", "2");

But the applicationInfo is not saved into the package manager. When packageManager.getApplicationInfo() is called afterwards, I get the old value.

I didn't see a setApplicationInfo() method, how can I proceed ?

Thanks

도움이 되었습니까?

해결책

AFAIK, the applicationInfo that getApplicationInfo returns is always a copy and there are no apis to change metadata

다른 팁

This meta data can be only supplied from Manifest file and can not be changed after that(as pointed above it will always return a copy and even if update it in some component it will not get updated originally)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top