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

前端 未结 7 1491
孤街浪徒
孤街浪徒 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:15

    You can put Parcable (bitmap for example) or serializable objects in a bundle and retrieve the object from the Bundle in the other activity.

    how do you pass images (bitmaps) between android activities using bundles?

    Although I would not recommend it because you pass a lot of data between activities. I would recommend you to pass the image reference id to the next activity and retrieve the image there.

    How to pass the selectedListItem's object to another activity?

    EDIT:

    intent.putExtra("imageId", imageId);
    

    in the other activity:

    int imageRef = getIntent().getIntExtra("imageId", defaultValue);
    

    http://developer.android.com/reference/android/content/Intent.html#getIntExtra%28java.lang.String,%20int%29

提交回复
热议问题