Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.BitmapFactory; public class Main { public static Bitmap loadEmptyBitmap(Context context, String file_path) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(file_path, options); Bitmap empty_bitmap = Bitmap.createBitmap(options.outWidth, options.outHeight, Config.ALPHA_8); return empty_bitmap; } public static Bitmap loadEmptyBitmap(Context context, int resId) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(context.getResources(), resId, options); Bitmap empty_bitmap = Bitmap.createBitmap(options.outWidth, options.outHeight, Config.ALPHA_8); return empty_bitmap; } }