I want to pass a image as a bitmap from one activity to another. And i want to know whether it is possible to do like that.
Sending Activity
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.f1);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] food = stream.toByteArray();
Intent intent = new Intent(MainActivity.this,NoBoringActionBarActivity.class);
intent.putExtras(bundle);
intent.putExtra("picture", food);
startActivity(intent);
Sending Activity
Bundle extras = getIntent().getExtras();
byte[] food = extras.getByteArray("picture");
Bitmap fo = BitmapFactory.decodeByteArray(food, 0, food.length);
mHeaderLogo = (ImageView) findViewById(R.id.header_logo);
//ImageView image = (ImageView) findViewById(R.id.header_logo);
mHeaderLogo.setImageBitmap(fo);
Receiving Activity
Don't forget to place your image in drawable.