Question

I am developing an app for Google glass using using a Immersion Pattern.

I am using start activity to switch between different tiles using below code.

Intent showImageDetails = new Intent(MainActivity.this, CapturedImageActivity.class);
showImageDetails.putExtra("IMAGE_DATA", data);
startActivity(showImageDetails);

data variable holds byte array for captured image.

Few time device is not able to start the activity and it exits the application and goes back to OK Glass tile.

Have anyone observed this issue?

I have used charades as an example which comes with API example.

Was it helpful?

Solution

Based on your comment, my wild guess is your image is too big to be sent with intent. Have you noticed the JAVA BINDER FAILURE error in the log or TransactionTooLargeException:

The Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions in progress for the process. Consequently this exception can be thrown when there are many transactions in progress even when most of the individual transactions are of moderate size.

Also see Passing data of a non-primitive type between activities in android:

What you do not want to do is pass big stuff via extras. For example, if you are creating an application that grabs pictures off the camera, you do not want to pass those in extras -- use a static data member (icky as that sounds). Intents are designed to work cross-process, which means there is some amount of data copying that goes on, which you want to avoid when it is not necessary for big stuff.

I think if your image is large, it is better to pass the URI or ResourceID of the image but not the image itself. Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top