Android :: Failed Binder Transaction When Returning Camera Image

Feb 15, 2010

I get the Failed binder transaction error in the logcat when returning the image taken with the camera from the camera intent back to the parent intent (as a byte[] using putExtra). I don't understand why, its not like its a big bitmap or anything. It only happens when i take pictures with lots of light, because then the byte[] is bigger. The error occurs when leaving the camera intent. Does anyone see a mistake in my code?

Here is the code of the camera intent:

CODE:.............

And here is the code that calls the camera intent:

CODE:..................

Android :: Failed Binder Transaction when returning camera image


Android :: Failed Binder Transaction When Passing Byte - From Camera - Between Intents

Feb 16, 2010

I have a problem with an app that lets the user take a picture. I've posted it on some forums already, but nobody seems to recognize the problem. Hopefully someone here knows a solution :)

I've put the code of taking a picture in a seperate activity. Then I call the camera intent from my main activity using activityForResult. In the camera intent, I use putExtra to return the camera image (as a byte[] without doing anything to it). But when the program transitions back from the camera intent to the parent intent that called it I get a Failed Binder Transaction error in the logcat because the byte[] is too big. But I don't understand this, because the image is not even taken using the maximum resolution :S

The code of my camera intent is:

CODE:......................

View 6 Replies View Related

Android :: JavaBinder - FAILED BINDER TRANSACTION

Jan 4, 2010

I currently have a lot of problems with this error. I programmed a widget and a service that runs in the background. This service is updating the widget on different occasions (position changed, screen turned on, timer based...) with images and text it's loading from a server. After a couple of updates I always get an error from the JavaBinder, at least that's what DDMS says. Reproducing the problem with my app is quite easy but I just can't figure out what's going on there.

View 6 Replies View Related

Android :: Remote Service Returning Value From Http Transaction

May 6, 2009

I've been researching how to best implement a service which performs a network transaction and returns data to the caller.

Clearly, this needs to happen on its own thread which means some form of async response. I can see at least three ways of doing this--some more complex than others. In the descriptions below, C is the caller, S is the service.

1) C wraps a Handler in a Messenger object, adds this to an Intent. C then calls startService with this intent. S extends IntentService which runs the Intents received in a worker thread. S then sends a message to C via the Messenger. This has the benefit of not requiring any of the async binding process or making an IDL interface that needs to be compiled into C. This seems to be the closes to a Handler-based response mechanism of Local Services.

2) C binds to S and then uses AsyncTask<> to make a blocking call to S. S performs the network transaction and returns the data in the return value or an out parameter. This requires the async binding process, but does not require a callback function since the inter- thread communications is handled by AsyncTask<> and the worker thread is in C's context.

3) Make the function called in S be completely asynchronous. S defines two interfaces: IMyService and IMyServiceCallback. S implements IMyService.Stub. C implements IMyServiceCallback.Stub. C binds to S then calls S via IMyService, passing its IMyServiceCallback binder. S spins up a worker thread and returns immediately. S then calls the callback when it has completed the network transaction.

I am asking for advice on which methods are most appropriate. I do not need the the service running constantly, only when the web transaction is required. C does not use S all the time--definitely don't want to bind during C's onCreate. However, I would like the time from when C determines it needs to use S to getting the results back to be as quick as possible (i.e. adding minimal latency to the already latent network access).

Is there any preference to having the worker thread in C or in S? Are there any significant problems with option 1?

View 11 Replies View Related

Android :: Camera Force Close When Returning From Sleep - Android

Aug 28, 2010

In my app I'm capturing an image. Everything is working fine unless the phone goes to sleep while the preview is running. Not really sure how to handle it, I'm thinking that it may be best just to prevent the phone from automatically going to sleep while this process is in action. Which I do not know how to do. And if I do that will it prevent the phone from sleeping when i press the power button? perhaps there is a deeper issue here.

LogCat:
08-28 16:17:10.879: WARN/dalvikvm(9652): threadid=3: thread exiting with uncaught exception (group=0x4001b390)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): Uncaught handler: thread main exiting due to uncaught exception
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): java.lang.RuntimeException: Method called after release()
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at android.hardware.Camera.setHasPreviewCallback(Native Method)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at android.hardware.Camera.access$600(Camera.java:58)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at android.hardware.Camera$EventHandler.handleMessage(Camera.java:339)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at android.os.Handler.dispatchMessage(Handler.java:99)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at android.os.Looper.loop(Looper.java:123)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at android.app.ActivityThread.main(ActivityThread.java:4595)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at java.lang.reflect.Method.invokeNative(Native Method)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at java.lang.reflect.Method.invoke(Method.java:521)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at dalvik.system.NativeStart.main(Native Method)

Takephoto activity:
public class takephoto extends Activity {
private static final String TAG = "GrowJournalDemo";
Preview preview; // <1> Button buttonClick; // <2>
String journ_id; String plant_id;
// private String plantid = ((resource) this.getApplication()).getplantId();
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.photo);
preview = new Preview(this); // <3>
((FrameLayout) findViewById(R.id.preview)).addView(preview); // <4>
String journalid = ((resource) this.getApplication()).getjournalName();
plant_id = ((resource) this.getApplication()).getplantId();
journ_id = journalid;
buttonClick = (Button) findViewById(R.id.buttonClick);
buttonClick.setOnClickListener(new OnClickListener() {
public void onClick(View v) { // <5>
// preview.camera.takePicture(shutterCallback, rawCallback, jpegCallback);
preview.camera.autoFocus(new Camera.AutoFocusCallback() {
Camera.ShutterCallback shutterCallback = new Camera.ShutterCallback() {
public void onShutter() {
// Play your sound here.
} };
public void onAutoFocus(boolean success, Camera camera) {
preview.camera.takePicture(null, null, jpegCallback);
} } );
} } );
Log.d(TAG, "onCreate'd");
} // Called when shutter is opened
ShutterCallback shutterCallback = new ShutterCallback() { // <6>
public void onShutter() { Log.d(TAG, "onShutter'd");
} };
// Handles data for raw picture
PictureCallback rawCallback = new PictureCallback() { // <7>
public void onPictureTaken(byte[] data, Camera camera) {
Log.d(TAG, "onPictureTaken - raw");
} };
// Handles data for jpeg picture
PictureCallback jpegCallback = new PictureCallback() { // <8>
public void onPictureTaken(byte[] data, Camera camera) {
FileOutputStream outStream = null;
try { android.os.Environment.getExternalStorageState();
// create a File object for the parent directory
File PhotoDirectory = new File(
android.os.Environment.getExternalStorageDirectory()+
"/GrowJournalPhotos/"+journ_id+"/"+plant_id+"/");
// have the object build the directory structure, if needed.
PhotoDirectory.mkdirs();
// create a File object for the output file
File outputFile = new File(PhotoDirectory, "photo.jpg");
// now attach the OutputStream to the file object, instead of a String representation
outStream = new FileOutputStream(outputFile);
outStream.write(data);
outStream.close();
Log.d(TAG, "onPictureTaken - wrote bytes: " + data.length);
setResult(RESULT_OK);
finish();
} catch (FileNotFoundException e) { // <10> e.printStackTrace();
} catch (IOException e) { e.printStackTrace();
} finally {
} Log.d(TAG, "onPictureTaken - jpeg");
} };
}

Preview surfaceview:
public class Preview extends SurfaceView implements SurfaceHolder.Callback {
private static final String TAG = "Preview";
SurfaceHolder mHolder; // <2>
public Camera camera; // <3>
Preview(Context context) {
super(context);
// Install a SurfaceHolder.Callback so we get notified when the
// underlying surface is created and destroyed.
mHolder = getHolder(); // <4>
mHolder.addCallback(this); // <5>
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); // <6>
} // Called once the holder is ready
public void surfaceCreated(SurfaceHolder holder) { // <7>
// The Surface has been created, acquire the camera and tell it where
// to draw.
camera = Camera.open(); // <8>
try {
camera.setPreviewDisplay(holder); // <9>
camera.setPreviewCallback(new PreviewCallback() { // <10>
// Called for each frame previewed
public void onPreviewFrame(byte[] data, Camera camera) { // <11>
Log.d(TAG, "onPreviewFrame called at: " + System.currentTimeMillis());
Preview.this.invalidate(); // <12>
} } );
} catch (IOException e) { // <13>
e.printStackTrace();
} }
// Called when the holder is destroyed
public void surfaceDestroyed(SurfaceHolder holder) { // <14>
camera.stopPreview();
camera.release();
camera = null;
}
// Called when holder has changed
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { // <15>
camera.startPreview();
} }
I've added a wake lock to prevent the phone from dimming, I feel this is a temporary solution though as there is still a force close when the device is forced to sleep via power button.

View 1 Replies View Related

Android :: Failed To Connect To Camera Serfice?

Sep 28, 2010

Why does "failed to connect to camera serfice" happen on occasions?

View 5 Replies View Related

Android :: Error While Opening The Camera - .setParameters Failed

Oct 8, 2010

I have included camera functionality in my application. I have also launched the app in the market. I got an error message from one of the users that he is getting an error while opening the camera...

I have tested the app on the device on 2.1. The error i got from the user is using nexus one which will mostly run 2.2...Here's the logcat error that i received...

java.lang.RuntimeException: setParameters failed

CODE:............

I ran the app on 2.2 emulator also to check it. But it worked fine. can anyone please tell me why the error is occuring?

Here is the class which i mentioned in the comments :

CODE:..................

View 1 Replies View Related

Samsung Captivate :: Camera Failed To Work

Jul 22, 2010

My camera stopped working at the worst time just when I needed to take some pics at a dinner today. Has anyone encountered a "Camera Failed" message after opening the Camera application? I tried rebooting many times (at least 5-6 times) hoping it was a software glitch, but would not go away. I was testing the GPS navigation (using Google Maps) and my battery drained from 60% to 30% in 20 mins!! Does using navigation or low battery charge screw up the camera?I was sure it was a HW defect thinking I had to return the unit, but when I got home, and plugged into wall charger for a few minutes, I found that camera started working again.

View 9 Replies View Related

Android :: What Is A Binder Callback

Aug 31, 2010

I have been watching the Google I/O presentation by Virgil Dobjanschi on the correct way to implement REST on Android with services and content providers. http://code.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html

Based on the video I'm doing things the wrong way, which is not surprising given how hard the right way is. Anyway, having been shown the promised land in the video I'm having a bit of a problem figuring out how to get there.

I have most of it nailed but the one thing that's defeating me is the Binder Callback that Virgil references in the slides (see link above), on page 43 it shows step 2 as starting the service with startService( intent ) and step 10 as returning status information using a Binder Callback. There is no example code anywhere in the presentation which is rather frustrating. There is talk of open sourcing the Twitter client which apparently uses this approach but nothing yet and the announcement was in April.

In the video he states: "What is a binder callback? A binder callback, think of it as an interface that was passed in the request intent."

I have searched all over the place but have not been able to find any doc or examples that show how to pass a callback as part of an intent. Nor can I figure out any other way of passing in a callback.

I thought he may be referring to binding to the service and implementing the callback that way. However, he is specifically referring to a local service and using strarSerice() and not bindService(). Also with bindService() the service will be destroyed if the activity is destroyed which defeats the idea. The workaround is to use startService() and then bindService() and leave the service running for the duration. The other problem with bindService() is that the callback can not be use until onServiceConnected() completes which complicates the code even further as the action instructions can not be passed in the intent because the return callback may not be in place in time to return the results.

View 1 Replies View Related

Motorola Droid :: Recovery Image For Nandroid Back Up Failed

Feb 15, 2010

So I just got my droid today, got it rooted, reflashed and booted the recovery image for the nandroid backup and performed a nandroid backup. This was all with the droid plugged into my computer.

Then I downloaded BB and when I went to do an nandroid restore i couldn't get it to boot into the new recovery mode...I keep getting the stock reboot symbols

anyone have any ideas? I just looked in my root of the SD card.....the nandroid folder is there, the back up I made is there, so is there a reason i am getting the stock recovery image when i hold down x and the power button?

View 1 Replies View Related

Samsung Galaxy S :: Camera Failed - Warning And Quits Out Of The App

Jun 21, 2010

The wife is on the road with her new samsung galaxy s. she needs to take some pics on this trip and the camera suddenly stopped working.. i tried the cam yesterday and it worked fine out of the box (phone is 2 days old now). when launching the camera app the phone throws up a 'camera failed' warning and quits out of the app.

View 10 Replies View Related

Samsung Galaxy S :: Warning Camera Failed - Hardware Issue

Sep 2, 2010

I've had my Samsung Galaxy S for a couple of weeks now, and the last time i took pictures with it was on 29th August. I tried the camera yesterday and got this message.

What happens is the camera app opens, and instantly displays this message and all you can do is click ok. When you do that, the app closes.

I tried many things, including trying to press other buttons quickly before the error message comes. I managed to switch to camcorder mode and even press the record button in that time, but all i got was video recording failed message.

I checked on the forums for people who had similar problems and here's a list of things i tried so far:

1- Uninstall Fring
2- Return to Factory Settings
3- Fully Recharge Phone
4- Take out battery, sim, external sd card, wait for 5 mins and restart
5- Take out external sd card altogether and restart

So far nothing has worked. I haven't dropped or hit the phone anywhere. It hasn't been in temperatures less than 10 degrees celcius or over 25.

I can't think of anything else to do really, other than calling up warranty line. The problem is i'm going on holiday soon and the only reason i wanted to get this phone before my previous contract ended was to be able to use the camera while on holiday and now all my plans have gone down the drain.

I even tried reinstalling fring and making a test call with it, and i can confirm my front facing camera is working fine. It's the one on the back that's not working.

I tried installing other applications as well which would use the phone's camera and every each of them force closed when i tried.

I can't send it off with warranty until i come back from holiday anyway, so maybe froyo would be rolled out by my provider by then... I wonder if that would fix things... But i thought returning to factory settings would have fixed it too, which it didn't...

View 4 Replies View Related

Jelly Bean :: Samsung Galaxy S4 Warning Camera Failed?

Oct 15, 2013

I was taking a walk and taking photos with my 2 month old galaxy s4. I have never had any issues with it. intill yesterday, I encountered a camera crash. I took out my camera, made a panorama, and then switched to auto mode and that's when my camera froze for like 30 seconds. after, it unfroze. I took a picture and the picture came out well accept the white black little horizontal lines on the top and bottom of the photo. after that I got worried so when I went back to the camera, it said the camera failed message and then it brought me to the home screen. after that, I accessed the camera again and everything was fine, the camera worked, accept the interface was frozen. I could not press the shutter button, gallery button, mode button, video button, etc. so I rebooted my phone and now the camera works perfectly. yesterday after the reboot I took pictures the whole day and It was perfect. today it is perfect too, no crashes. im just getting a little paranoid about why this happened and I am scared something is wrong with my phone as I worked and paid full price. everything is alright now im just wondering, was this a glitch in the software? did the camera crash because it was having a hard time that second to go back to auto mode from panorama mode? this is again, not happening any more but what was the message all about? how come it works now? is my phone alright?

View 7 Replies View Related

General :: Samsung Galaxy Note II - Camera Failed When Opened

Feb 26, 2013

I have an Note II , and several days ago it gave message "camera failed" when i open camera. front camera is working. but primary doesn't.

I have tried everything, even changed 4.1.1 to 4.1,2

View 3 Replies View Related

General :: Camera Failed On Samsung Galaxy Y Pro Duos Gt - 5512

Apr 27, 2013

I have Samsung galaxy y pro duos....

when I open the camera >>it shows "camera failed ErrorCallback.onError(1) and the camera not working .... when i call *#34971539# ....Nothing Happened ...I Think I don't have a firmware for the camera ... how can i fix this ???

View 8 Replies View Related

Android :: Binder Is Leaked By Binding To A Service

Jul 30, 2010

I made a code for my understanding of Android Service class.

It has just a single Activity and Service in apk. Service is the same as the sample code of API reference as below: http://developer.android.com/intl/ja/reference/android/app/Service.ht...

A client side is an Activity based on the above sample, and just added the following code:

CODE:.......

My sample application has a check box which starts(binds)/unbind to the local service on a single process. The local service instance is created by every bind request (and destroyed by every unbind).

If I press the button repeatedly, then LocalService$LocalBinder is leaked!

The problem is not resolved even If I set an obtained binder to null (like below).

CODE:...............

View 6 Replies View Related

Android :: How To Get Image URI From Camera?

May 6, 2009

I need to start the Camera activity from within my application, take a picture, and return the photo URI to another activity. Surely this should be straightforward? But the Camera API sample code doesn't show how to get the URI. I can't find the answer on this forum, either.

View 14 Replies View Related

Android :: Way To Get Image Uri From Camera?

Mar 8, 2010

I have an application that calls the android phone's default camera to take photo the following is my code...

View 1 Replies View Related

Android :: Adding Native Binder Service Permission Error

Sep 10, 2010

What is the best way to add a new native service that uses Binder and can get past the service_manager.cpp restrictions on what users can add services? I have created a new native service that is similar to the MediaPlayer. I make the addService() calls to add the Binder service to the system. This worked fine when the service was started as root. I moved the new service to be started as the "media" user. Then I receive permission errors because of the table in service_manager.cpp where there is a check for users and allowed Binder services. Do I have to add my service to the table or is there some other way?

View 2 Replies View Related

Android :: Main And Three Binder Threads Are Running After Application Close

May 21, 2009

My application starts a remote service and binds to it. If I close the application with the "back" button there are still some threads running (listed in the Debug View of Eclipse) - main thread, and three Binder threads. In onDestroy() I call unbindService(service_connection) - is there something else to clean up?

View 4 Replies View Related

Android :: Way To Get Image Data From Camera?

Apr 10, 2009

I am working on image processing in mobile. When Camera,takePicture(null,null,pictureCallback) called I am getting (640*480) JPEG image data, its taking 1 second delay.When I try to get raw data it returns null value.I am interested only on delay.

View 2 Replies View Related

Android : How Can I Set Transaction Size On Phone?

Feb 23, 2009

I create a Person class implements Parcelable in Android, The Person include a byte array field. When set the byte array size more than 40000, then find !!FAILED Binder Transaction!! Why the byte size so limit ? How can I set the transaction size in Android?

View 2 Replies View Related

Android :: How To Pass Complex Data Structures Between Service And Remote Binder?

Feb 17, 2010

The object passing between an Android service and the remote binder is happening through serialization of the object. If the service needs to return a very large collection, it seems very inefficient to use this. What is the recommended way to deal with this?

View 1 Replies View Related

Android :: 1.6 Camera Rotation / Image Size

Oct 21, 2009

My application while compiled in 1.5 works fine. I had some memory issues w/ 1.6 due to image size, which was strange b/c the image size increased when taking photos by taking a picture w/ surfaceholder/imagecapture callback. I seem to have fixed re-displaying those images by resizing them using a bitmapfactory matrix. But my camera is now rotating everything 90 degrees. It appears that my Override of surfaceChanged does nothing, which is where I was setting rotation at 90 (I can't remember why, it was 10 months ago!). I have tried at rotating the camera parameters paramters at 90 degrees, 0 degrees.

View 2 Replies View Related

Android :: Image Processing On Picture Taken From Camera

Jan 11, 2010

I'm writing an application for Android. I need to make some image processing on the picture taken from camera.I use Camera.PictureCallback to get the photo, and I get picture in byte array.The problem is I want to make operations on every pixel of photo (some filtering and other stuff) so I guess, have photo in byte array is not a bad idea. But I don't know how interpret information in this byte array... The only way I know to make the processing is use BitmapFactory.decodeByteArray() and then use Bitmap object. Is this a good way to handle a lot of image processing?

View 1 Replies View Related

Android :: How To Save Camera Captured Image?

Jul 6, 2009

I am working with camera.. I am facing one problem during capturing image.The image is not saving directly to gallery.But when i reboot my device its appearing. Can anybody tell me why this happens.and How can i solve it.

View 4 Replies View Related

Android :: How To Overlay Image Over Camera Preview?

Jan 30, 2009

Does someone know how I can overlay an image over the camera preview?

View 6 Replies View Related

Android :: How To Load Camera Image As Bitmap

Jun 1, 2010

I am using BitmapFactory.decodeFile to load Bitmaps of images into my application. However, the function returns null on large images (such as those from the camera). The filepath is definitely correct, I just can't figure out why it would return null. I tried supersampling, but it didn't seem to help.

Does anyone have any idea why it would do this or how I could more easily load images taken from the camera into a Bitmap?

Here's the code I am using...

View 3 Replies View Related

Android :: How To Get A Handle On Each Image While Recording From Camera

Jul 17, 2010

How do I obtain a handle on each image that the camera feeds into your recorder application?

View 1 Replies View Related

Android :: Setting Camera Image Size?

Aug 17, 2010

At the moment I am attempting to set my camera on my Motorola Droid phone to take an image that matches the size of my screen (854 x 480 pixels), and I am attempting to accomplish via the parameters for the camera as such:

CODE:.................

I have my activity implement the Camera.PictureCallback method of onPictureTaken (excluding log calls), so when the takePicture method is called it runs this method:

CODE:..........

For some reason though, my camera is taking pictures in 1280 x 960. Is this some sort of minimum size the camera can capture an image in? From log calls I can see that the Camera's parameters are still set to have a picture size of 854 x 480, but image keeps coming out as 1280 x 960. Am I decoding the image incorrectly, am I setting the camera's parameters incorrectly, or am I doing something else wrong?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved