in First Activity:
in First Activity:
Intent intent=new Intent(FirstClass.this, SecondClass.class); Bundle bundle=new Bundle(); bundle.putInt("image",R.drawable.ic_launcher); intent.putExtras(bundle); startActivity(intent);in Second Acticity:
Bundle bundle=this.getIntent().getExtras(); int pic=bundle.getInt("image"); v.setImageResource(pic);another method:
in First Activity:
Drawable drawable=imgv.getDrawable(); Bitmap bitmap= ((BitmapDrawable)drawable).getBitmap(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); byte[] b = baos.toByteArray(); Intent intent=new Intent(Passimage.this,myclass.class); intent.putExtra("picture", b); startActivity(intent);in Second Acticity:
Bundle extras = getIntent().getExtras(); byte[] b = extras.getByteArray("picture"); Bitmap bmp = BitmapFactory.decodeByteArray(b, 0, b.length); ImageView image = (ImageView) findViewById(R.id.imageView1); image.setImageBitmap(bmp);
This code can't working........
ReplyDeleteMake sure that you are sending an image..The code works for me..
Deletethank you that really helps alot
ReplyDeletewooooooooooooooooooooooooooooooooooooooooooooorking!!!!!!!!!!!!!!!!!!!!!!!!!
ReplyDeletethanks very much is working ..................................................!
ReplyDeletethanks very much is working....!
ReplyDelete