Bitmap.Config conf = Bitmap.Config.ARGB_8888;
WeakReference<Bitmap> bm = new WeakReference<Bitmap>(Bitmap.createBitmap(3000 + 3000, 2000, conf));
Canvas canvas = new Canvas(bm.get());
canvas.drawBitmap(firstBitmap, 0, 0, null);
canvas.drawBitmap(bm, firstBitmap.getWidth(), 0, null);
imageView.setImageBitmap(bm);
---------------orintation memory leak
private ImageView miniPicture;
private String imagePath;
private WeakReference<Bitmap> imageBitmap;
....
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 8;
imageBitmap = new WeakReference<Bitmap>(BitmapFactory.decodeFile(imagePath, options));
miniPicture.setImageBitmap(imageBitmap.get());
--------------
In your onDestroy method you could try something like this:
ImageView imageView = (ImageView)findViewById(R.id.my_image);
Drawable drawable = imageView.getDrawable();
if (drawable instanceof BitmapDrawable) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
Bitmap bitmap = bitmapDrawable.getBitmap();
bitmap.recycle();
}
public void setImageBitmap(Bitmap bm) {
setImageDrawable(new BitmapDrawable(mContext.getResources(), bm));
}