Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #390 from xufan/master
fix miui 8 developer version issue
  • Loading branch information
galenlin committed Dec 27, 2016
2 parents 825d7b3 + 8b81dae commit 921c3d8
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -445,7 +445,13 @@ public static void mergeResources(Application app, Object activityThread, String
Field mResourcesImpl = Resources.class.getDeclaredField("mResourcesImpl");
mResourcesImpl.setAccessible(true);
Object resourceImpl = mResourcesImpl.get(resources);
Field implAssets = resourceImpl.getClass().getDeclaredField("mAssets");
//check if rom change resourceImpl may be a subclass of resourceImpl like miui8
Field implAssets;
try {
implAssets = resourceImpl.getClass().getDeclaredField("mAssets");
} catch (NoSuchFieldException e) {
implAssets = resourceImpl.getClass().getSuperclass().getDeclaredField("mAssets");
}
implAssets.setAccessible(true);
implAssets.set(resourceImpl, newAssetManager);
}
Expand Down

0 comments on commit 921c3d8

Please sign in to comment.