Consider a,b,c,d,e are all strings that aren't null.
I have an object called data that holds the URLs for image and prev_image.
There's an activity named Games, leading to "MyActivity".
My problem is as such:
If I try to "putextra" both bitmaps, I end up in "Games", no errors given, no exceptions, no nothing.
If I comment out the line where I add "image" to the bundle, then everything works.
But I need image in a later activity. so I must have it there.
I tried scaling it down but it didn't help, it doesn't seem like a memory issue, but...
I could be wrong :)
Bitmap temp = BitmapFactory.decodeStream((new URL(data.getString("image"))).openStream());
image = image = Bitmap.createScaledBitmap(image,300,300,true);
temp = BitmapFactory.decodeStream((new URL(data.getString("image"))).openStream());
prev_image = Bitmap.createScaledBitmap(image,300,300,true);
temp.recycle();
Intent intent = new Intent(MyActivity.this,NextActivity.class);
intent.putExtra("a",a);
intent.putExtra("b",b);
intent.putExtra("c",c);
intent.putExtra("d",d);
intent.putExtra("e",e);
intent.putExtra("image",image);
intent.putExtra("prev_image",prev_image);
startActivity(intent);
Any help would be much appreciated.
Edit:
I figured I'd add the solution I used for my app.
What I ended up doing was save the bitmaps as files and just pass the URI's to the files between activities and only load the bitmaps in activities that need them.
And of course, eventually deleting the files.
I don't want to download the bitmap on the next intent because the current intent is a "loader" that is meant to save the loading time on the next intent. – Chen Doron Dec 09 '12 at 17:48