get Bitmap From Asset


/ Published in: Java
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.