Android add extra skin as separate APK
Asked Answered
C

1

14

I have a simple android app to play videos. I have a main screen containing few buttons. If you press the button it will play the videos. Everything works fine.

My problem is that my main screen have one background image also there is one image for buttons. i have one button to choose the skin for the app. There are three options. When I choose three options, the background image and button image will change. Now I want to give the skins (contains background image and button image) as separate apk at later stages. When I install this apk it should be shown with the already existing skin. Which is the easiest way to accomplish this?

Thanks

Culverin answered 10/3, 2012 at 5:3 Comment(0)
P
2

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

Papery answered 6/4, 2012 at 17:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.