Posted By

l01241 on 07/23/12


Tagged

image jpg bitmap android asset


Versions (?)

get Bitmap From Asset


 / Published in: Java
 

private String mapPath = "img/full_map.png"; parkMapBitmap = getBitmapFromAsset(this.getContext(),mapPath);

  1. private static Bitmap getBitmapFromAsset(Context context, String strName) {
  2.  
  3. AssetManager assetManager = context.getAssets();
  4.  
  5. Bitmap bitmap = null;
  6. try {
  7. istr = assetManager.open(strName);
  8. bitmap = BitmapFactory.decodeStream(istr);
  9. } catch (IOException e) {
  10. return null;
  11. }
  12.  
  13. return bitmap;
  14. }

Report this snippet  

You need to login to post a comment.