Code to Pass bitmap between activities in android

by Preetha 2012-09-14 11:42:04

package com.AndroidPassingBitmap;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;

public class AndroidPassingBitmap extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon);

Intent intent = new Intent();
intent.setClass(AndroidPassingBitmap.this, AndroidReceiveBitmap.class);
intent.putExtra("Bitmap", bitmap);
startActivity(intent);

}
}

Tagged in:

884
like
0
dislike
0
mail
flag

You must LOGIN to add comments