Android add extra skin as separate APK

旧城冷巷雨未停 提交于 2019-12-03 23:47:41
kingori

I didn't tried to read theme from other apk, but I think you can use this strategy.

  1. find your theme package from device. To do this, you should make a naming rule or some method to check whether that package is your theme apk or not. I assume that you name theme apk as 'com.myapp.theme.????'

  2. if you find theme apk, read asset file from that app. I don't know how to do this, but this link will help you. Access Assests from another application?

PackageManager pkgMgr = ctx.getPackageManager();
List<ApplicationInfo> apps = pkgMgr.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo ai : apps) {
  String pkgName = ai.packageName;
  if( pkgName.startsWith( "com.myapp.theme" ) {  //this pkg is your theme pkg
       //access asset of this app
  }
}

fff

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!