You added a Bundle to the Intent so you should get a Bundle from the
the Intent and then get the array from the Bundle.

put: Intent      putExtra(String name, Bundle value)
get: Bundle      getExtras()


put: Intent      putExtra(String name, byte[] value)
get: byte[]      getByteArrayExtra(String name)

but not

put: Intent      putExtra(String name, Bundle value)
get: byte[]      getByteArrayExtra(String name)

On Jul 31, 5:58 pm, Arascii <> wrote:
> Hi,
> This seems like a very simple question with a simple answer except I
> haven't been able to find said answer anywhere.
> I've taken a picture using the camera, I have a byte array called
> data, which I want to pass to another class to process.
> Here's how I package the data:
> Camera.PictureCallback mPictureCallback = new Camera.PictureCallback()
> {
>                 public void onPictureTaken(byte[] data, Camera camera) {
>                 startImageProcess(data);
>                 }
>         };
>         public void startImageProcess(byte[] mBmp)
>         {
>                 Intent mI = new Intent(this, ProcessImage.class);
>                 Bundle myBundle=new Bundle();
>                 myBundle.putByteArray("mBmp",mBmp);
>                 mI.putExtras(myBundle);
>                 startActivity(mI);
>         }
> This part seems to work fine. However, when it starts the ProcessImage
> activity, I get a crash when the following code is called:
> public class ProcessImage extends Activity{
>         public void onCreate(Bundle savedInstanceState)
>         {
>                 super.onCreate(savedInstanceState);
>                 Intent thisIntent = this.getIntent();
> <crash>    byte[] data = thisIntent.getByteArrayExtra("mBmp");
> I've tried many different combinations of getExtra, getExtras,
> getByteArrayExtra, etc. I've also tried different methods for
> inserting the extra. I'm at the end of my rope. Could someone please
> help?
> Thanks,
> Arascii

You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at

To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to