List of usage examples for android.content.res AssetManager getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:Main.java
public static AssetManager createAssetManager(String dexPath) { try {/*from w w w . jav a2 s . c om*/ AssetManager assetManager = AssetManager.class.newInstance(); Method addAssetPath = assetManager.getClass().getMethod("addAssetPath", String.class); addAssetPath.invoke(assetManager, dexPath); return assetManager; } catch (Exception e) { e.printStackTrace(); return null; } }
From source file:com.ryg.dynamicload.DLProxyFragmentActivity.java
protected void loadResources() { try {/*from w w w .ja va2 s . c o m*/ AssetManager assetManager = AssetManager.class.newInstance(); Method addAssetPath = assetManager.getClass().getMethod("addAssetPath", String.class); addAssetPath.invoke(assetManager, mDexPath); mAssetManager = assetManager; } catch (Exception e) { e.printStackTrace(); } Resources superRes = super.getResources(); mResources = new Resources(mAssetManager, superRes.getDisplayMetrics(), superRes.getConfiguration()); }