Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
galenlin committed Jan 4, 2017
2 parents 54afc98 + 921c3d8 commit fbaf6b0
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
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 fbaf6b0

Please sign in to comment.