Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Send ByteArray from one Activity to another, at the moment i use intent.putextra, are there other ways to do this?

Hi guys, I want to send a byte array from one activity to antoher at the moment i use intent.putExtra("testPicture", byteArray);

I get this intent at the other activity like:

TestPicture = getIntent().getByteArrayExtra("testPicture");

When i've done that i put them in namevaluepairs like this:

nameValuePairs.add(new BasicNameValuePair("profilePicture", new String(Base64.encode(TestPicture,Base64.DEFAULT))));

When i test my application i get an error in nameValuePairs. Do you guys know why i get these error and if there are other methods to put a byteArray from one to another activity?

BTW I use the same code when everything was working fine in one activity the Image was uploaded perfectly, but when i tryed to get the image uploaded in an other activity it goes wrong..

Thanks in advance!