use of android.content.res.AssetManager in project atlas by alibaba.
the class DelegateResources method updateResources.
private static synchronized void updateResources(Resources res, String assetPath, int assertType) throws Exception {
if (sAssetManagerProcessor == null) {
sAssetManagerProcessor = new AssetManagerProcessor();
}
AssetManager updatedAssetManager = sAssetManagerProcessor.updateAssetManager(res.getAssets(), assetPath, assertType);
if (sResourcesProcessor == null) {
sResourcesProcessor = getResourceProcessor();
}
sResourcesProcessor.updateResources(updatedAssetManager);
if (sResourcesFetcher == null) {
sResourcesFetcher = new ResourceIdFetcher();
}
sResourcesFetcher.addAssetForGetIdentifier(assetPath);
}
use of android.content.res.AssetManager in project atlas by alibaba.
the class ResourceIdFetcher method addAssetForGetIdentifier.
public void addAssetForGetIdentifier(String newPath) throws InstantiationException, IllegalAccessException, InvocationTargetException {
try {
// Make asset for getIdentifier on android 5.0
if ((AtlasHacks.AssetManager_addAssetPath != null) && (AtlasHacks.AssetManager_ensureStringBlocks != null) && Build.VERSION.SDK_INT > 20) {
AssetManager asset = AssetManager.class.newInstance();
AtlasHacks.AssetManager_addAssetPath.invoke(asset, newPath);
AtlasHacks.AssetManager_ensureStringBlocks.invoke(asset);
assetList.add(asset);
}
} catch (Throwable e) {
}
}
use of android.content.res.AssetManager in project restful-android by jeremyhaberman.
the class AboutActivity method getInputStream.
private static InputStream getInputStream(Context context, String filename) {
AssetManager assetManager = context.getAssets();
InputStream inputStream = null;
try {
inputStream = assetManager.open(filename);
} catch (IOException e) {
Log.e(TAG, e.getLocalizedMessage(), e);
}
return inputStream;
}
use of android.content.res.AssetManager in project Talon-for-Twitter by klinker24.
the class IOUtils method readChangelog.
public static String readChangelog(Context context) {
String ret = "";
try {
AssetManager assetManager = context.getAssets();
Scanner in = new Scanner(assetManager.open("changelog.txt"));
while (in.hasNextLine()) {
ret += in.nextLine() + "\n";
}
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
return ret;
}
use of android.content.res.AssetManager in project android-stackblur by kikoso.
the class MainActivity method getBitmapFromAsset.
private Bitmap getBitmapFromAsset(Context context, String strName) {
AssetManager assetManager = context.getAssets();
InputStream istr;
Bitmap bitmap = null;
try {
istr = assetManager.open(strName);
bitmap = BitmapFactory.decodeStream(istr);
} catch (IOException e) {
return null;
}
return bitmap;
}
Aggregations