0

long story short, ive got fragmnet (catalog) which holds cardview, that fills from json file that stream from my server.

on card click, im poping DialogFragment, that asks the user to fill how many items he want from this specific "product", after i get the quantity, my dilemma starts...

How to pass the image itself to the dialog and from the dialog to the fragment (userCart), I want to display the image again in listview in userCartFragment.

I know passing view isn't a solution, but i read that maybe with uri its is possible, and so with the bitmap convertion to array.

Which way you guys think would be better, or maybe you have any better solution for this.

Any advise/snippet would be appreciated! Thank you!

2Stoned
  • 325
  • 2
  • 8
  • 23

2 Answers2

0

Use Uri to pass images.

Otherwise, if the image size is too large it might create some memory issues. Also, there is a size limit (1 MB) in passing extras between activities or fragments.

Check this link

Community
  • 1
  • 1
Newbie
  • 368
  • 3
  • 12
  • @2Stoned Always welcome. If you want to manage image loading efficiently. Try any of the libraries from the link according to your requirements. Check this http://stackoverflow.com/questions/29363321/picasso-v-s-imageloader-v-s-fresco-vs-glide – Newbie Jul 14 '16 at 12:13
0

Better Solution: Load image with URI

The reason:Simple&Uncomplicated,

If you use Glide, you just code like this Glide.with(this).load("YOUR URL").into(imageView); It's just one step. Make's your URL to be public static so variable can access in all class.

If you use bitmap conversion at least you need 3-4 step so you can load image to another fragment.