0

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.

Pankaj Kumar
  • 81,967
  • 29
  • 167
  • 186
Hari Soni
  • 195
  • 3
  • 14
  • Add error log if any? – Pankaj Kumar Aug 01 '14 at 05:28
  • There were no errors logs. All the code is executed properly without error and Issue is not 100% reproducible. – Hari Soni Aug 01 '14 at 05:55
  • @user2660059 could you give more your "data" variable? – pt2121 Aug 04 '14 at 16:59
  • Its a byte array for image which is captured. Image size is around 459238 bytes after capture (jpg file format). I was able to find the pattern to the issue. If my glass is too hot (After lot of usages) then i am able to reproduce the problem very frequently. Then the only solution is to shutdown the Glass and restart once it cools down. Have anyone else observed this issue? Let me know if more information is needed. TIA. – Hari Soni Aug 05 '14 at 04:49

1 Answers1

0

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.

Community
  • 1
  • 1
pt2121
  • 11,720
  • 8
  • 52
  • 69
  • 1
    i am writing the file to sdcard and reading it in another activity. but i am still not so sure why android is not able to throw an exception when it is not able to start the activity. – Hari Soni Aug 22 '14 at 05:41