get ImageView's image and send it to an activity with Intent

前端 未结 7 1521
孤街浪徒
孤街浪徒 2020-12-06 03:22

I have a grid of many products in my app. when the user selects one of the item in the grid, I am starting a new activity as DIALOG box and display the item\'s name,quantity

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 04:01

    Use Bundle like

    imageView.buildDrawingCache();
    Bitmap image= imageView.getDrawingCache();
    
     Bundle extras = new Bundle();
    extras.putParcelable("imagebitmap", image);
    intent.putExtras(extras);
    startActivity(intent);
    
    
    Bundle extras = getIntent().getExtras();
    Bitmap bmp = (Bitmap) extras.getParcelable("imagebitmap");
    
    image.setImageBitmap(bmp );
    

提交回复
热议问题