Camera Force Close In App When Take Photo?

Nov 26, 2012

i have an apk app which can take photo and take video with a button.

I have first device running the app and I have 2 button, take photo and take video.When I click take video in this app and it works well but when i click take picture from the button, the app always "force closes".

this is my error logcat

11-19 14:43:27.085: ERROR/AndroidRuntime(6903): FATAL EXCEPTION: main 11-19 14:43:27.085: ERROR/AndroidRuntime(6903): java.lang.NullPointerException
11-19 14:43:27.085: ERROR/AndroidRuntime(6903): at [code].......

camera force close in app when take photo?

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.

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(
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at android.hardware.Camera$EventHandler.handleMessage(
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at android.os.Handler.dispatchMessage(
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at android.os.Looper.loop(
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at
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(
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at$
08-28 16:17:10.879: ERROR/AndroidRuntime(9652): at
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) {
preview = new Preview(this); // <3>
((FrameLayout) findViewById(; // <4>
String journalid = ((resource) this.getApplication()).getjournalName();
plant_id = ((resource) this.getApplication()).getplantId();
journ_id = journalid;
buttonClick = (Button) findViewById(;
buttonClick.setOnClickListener(new OnClickListener() {
public void onClick(View v) { // <5>
//, rawCallback, jpegCallback); Camera.AutoFocusCallback() {
Camera.ShutterCallback shutterCallback = new Camera.ShutterCallback() {
public void onShutter() {
// Play your sound here.
} };
public void onAutoFocus(boolean success, Camera camera) {, 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(
// have the object build the directory structure, if needed.
// 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);
Log.d(TAG, "onPictureTaken - wrote bytes: " + data.length);
} 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) {
// 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 =; // <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>
} }
// Called when the holder is destroyed
public void surfaceDestroyed(SurfaceHolder holder) { // <14>
camera = null;
// Called when holder has changed
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { // <15>
} }
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

Motorola Milestone :: Force Close

Feb 27, 2010

Maybe someone can help me out. I just got a brand new Milestone direct from Telus. It was working awesome for the first day, but now the camera app force closes.Here are the deets:

-with location services and/or GPS enabled, crashes 100% of the time when the location has been established

-with location services and GPS disabled, camera app works 100% with NO force close

-did a hard reset (wipe)

-tested GPS, working

-tested location services aka a-gps, working

Seems to me it must be a corrupted camera app, but I'm not sure how to fix this.

View 1 Replies View Related

Motorola Milestone :: Camera - Photo Right Edge Shows A Thin Vertical Strip Of Next Photo

Oct 20, 2010

Has anyone else experienced a strange problem with the Milestone (running 2.1) camera - in every photo, the right edge shows a thin vertical strip of the next photo! Shows in both Gallery & Media Gallery.. but don't have a similar issue in a video.

View 5 Replies View Related

HTC EVO 4G :: Application HTC Have To Force Close It

Jun 4, 2010

DM (process service) has stopped unexpectedly. Please try again.The above shows up when I got the phone. I have to Force Close it. Any idea what is going on?

View 5 Replies View Related

HTC EVO 4G : Qik App Force Close Will Not Recover

Jun 10, 2010

When I ever I try to use Qik the Sorry Force Close screen comes up. It says: The application Qik (process has stopped unexpectedly. Please Try again. I have powered the phone down three times and pulled the battery once and this error will not go away.

View 2 Replies View Related

Force Close Errors

Feb 5, 2012

i am creating an application with many activity and my first page is login.. i executed a few hours ago there was no such error and it executed successfully after that i extend the coding and i again executed when i was clicking the application to open instead of showing the login page it's showing the force close error..

View 1 Replies View Related

Startactivity Force Close

Mar 4, 2012

package com.danielholst.soundmixer;
import android.content.Intent;
import android.os.Bundle;

public class LoadingSplashScreen extends Activity {
/** Called when the activity is first created. */

[Code] ...

xml here

android:theme="@android:style/Theme.NoTitleBar" >

[Code] ......

View 1 Replies View Related

General :: How To Force Close App

Apr 13, 2013

Is there an app out there that can force close a different app on command? Or is there a way to do it without using a different app?

View 5 Replies View Related

General :: App Force Close When Run It In AVD

Dec 14, 2013

My app is force close when i run it in AVD

Download : [URL] .....

View 1 Replies View Related

HTC EVO 4G :: Qik Won't Open And I Get A Force Close Dialog?

Jun 16, 2010

Anyone experiencing force close with Qik app? It was working ok now it won't open and I get a force close dialog.

View 3 Replies View Related

Motorola Droid :: SMS Force Close?

Mar 30, 2010

I just got my droid about 2 weeks ago. I returned it the next day because it kept force closing on my sms. They gave me a new one and haven't had the problem.until yesterday. At least twice a day now, since yesterday, i get a message saying: The application Messaging (process has stopped unexpectedly. Please try i hit Force Close and then it just stays on a blank black screen so i hit the home button and hit messaging again and it pops up again. I take the battery out and that works for a few hours but then it just happens again...i don't wanna take this one back again and get a new one.I mean i have anti-virus (i dunno if it's good though lol) so I don't think it could be an app...i use the standard Messaging app that came with the phone, not Handcent or something else.will someone.I searched but they all seemed to be for different phones, not the droid.

View 9 Replies View Related

Android :: Force Close - Debug

Jun 9, 2010

Is there a writeini / readini functions for andriod/ecplise developent? Or what is the best way to 'remember' a setting, and then at a later time restore it?

View 5 Replies View Related

Android :: My Eclipse 3.5 Always Lag And Have To Force Close - Why?

Jul 30, 2010

I'm on Win7 32-bit with 4GB RAM. Why my Eclipse always become so slow until it take so long to response to my mouse or keyboard. I have to force terminate it, restart and use it for like 20min and repeat the same thing again.Anyone facing this or have experience dealing with it?

View 1 Replies View Related

Android :: Force Close Error

Sep 1, 2010

" The application com.sym.activitu(process com.sym.activity) has stopped unexpectly. Please try again "the above msg occur in running time so please give solution

View 2 Replies View Related

Android :: Force Close Just Restarts App?

Feb 13, 2010

I've noticed that whenever I introduce some new awful bug to my app and it crashes, Android just keeps starting it up over and over again. I eventually have to hit the dial button on the phone just to make my app lose focus. I searched this group's posts and the developer documents.I can't find anything about this. Is this usual behavior? If so, is there some way to disable it? Maybe it's just my coming from a desktop background, but I kind of think that when something is closed, it should stay closed, especially if the reason it was closed was that it crashed. And of course, I hope my final app never force closes, but with all the different hardware you never know.

View 6 Replies View Related

Android :: Force Close Timer?

Dec 28, 2009

Is there an app that lets you set a countdown timer on another app which causes it to force close. For example, I use my Eris as my MP3 player and would like to listen to it while I go to sleep, however I don't wanna let it play all night while I'm sleeping maybe just an hour or so.*Edit* Nevermind I found an app that does the job. Its called Music Sleep. It lets you set a timer that will close your music app in case anyone else was interested. It only costs 99 cents

View 2 Replies View Related

HTC Desire :: HTC Sense UI Force Close

Sep 1, 2010

I am running the OTA version of Froyo on my non-rooted Desire and I am finding that the HTC Sense UI seems to force close about once a week. The main culprit seems to be the HTC News widget as it most often seems to occur whilst I am reading my news each morning.Anyone else experienced this or know the solution?

View 3 Replies View Related

HTC EVO 4G :: Force Close With Gallery Root Cause?

Sep 20, 2010

Each time I try to access my "gallery" I get a force close. It will let me open the main gallery folder, but as soon as I select a sub folder it force closes. Any ideas why this may be happening or how to stop it? I don't know if this is a root issue or not but i figured some of the most "informed" people hang out here. Its making it very hard to customize anything.

View 1 Replies View Related

HTC EVO 4G :: YouTube Application Force Close

Jul 15, 2010

My YouTube app is force closing every time I try to open It. Is anyone else experiencing this problem? I pulled the battery twice already. It was working fine yesterday. The widget seems to be working.

View 4 Replies View Related

HTC Incredible :: Force Close Email

Nov 14, 2010

I cant use my email. The gmail account works fine but the other icon doesn't. Whenever I tap on it, it FC. Whenever I reboot my phone, force close screen comes up twice.

View 5 Replies View Related

HTC Hero :: Calender Force Close

Aug 31, 2009

Is anyone experiencing a lot of force closes for the calender app on the Hero? I've tried inputting some info 3 times now and each time it is closing. Has anyone else run into this or does anyone know of a solution?

View 4 Replies View Related

Sprint HTC Hero : LPP With CM6 Force Close

Nov 22, 2010

since the latest stable, and now the 133 full, it seems like 5 or 6 times a day im getting LPP force closes. Anyone else getting this or know of a way to fix this? Could there be something Im doing to cause this? Just to clarify, it happens when trying to hit an icon, as well as when trying to close an app with the back button. In the past, I have hit the home button to exit out, but since made an attempt to change my habits, as it seems hitting home keeps the app running.

View 10 Replies View Related

HTC Incredible : Getting Random Force Close

May 16, 2010

I keep getting random force close messages. I tap force close, which I guess means the app with the problem closed, but nothing really happens. Other than the inconvenience of the pop up message.

Usually it's .com or .HTC processes.

View 2 Replies View Related

HTC Incredible : Friendstream Force Close

Jun 23, 2010

Is there any way to fix the Friend Stream force close issue without a factory reset? I feel like that would be a huge hassle just to get this app to work again.

Also, whenever I receive a message in my inbox on Facebook the page just doesn't load when I try to access it from the Facebook application. I am always forced to go to the Facebook mobile site to check my inbox and I can't do it through the app.

View 1 Replies View Related

HTC EVO 4G : Sense Force Close - Every 5 Minutes Or So

Jun 21, 2010

My HTC Sense is force closing every 5 minutes or so. I have battery pulled, uninstalled software, etc. I am about to do a factory reset but is there any software that is known to cause this problem (so I can avoid it on the second go around)?

Note: It appears to happen when i go to 'change the scene' to something else. When the screen reloads it just goes into an endless cycle of 'HTC Sense Force Close'.

View 3 Replies View Related

HTC Hero : Force Close On Calendar

Oct 13, 2009

I'm on Orange and have the new ROM. Ever since it was installed I am getting force close errors on the Calendar service when I try and run the Android calendar. I get the error when I clock the calendar icon and then it is OK when I try a second time. I use Quick Calendar as well to provide a widget with next 2 appointments on - sometimes this report calendat service not found. All my appointments are synced from Outlook (not Exchange). Anyone else getting these force closes?

View 3 Replies View Related

HTC Hero : PC_Synchronisation Force Close

Jan 3, 2010

Has anyone else been unable to sync your Hero due to a force close of the pc_synchronisation?
My PC finds my phone without a problem, HTC Sync runs fine on my PC, the sync runs for about 10-15% until the pc_synchronisation force close pops up on my hero and the sync fails on my PC with the error mobile connection time out

I can find a lot of queries/answers about HTC Sync problems on PCs but I can't find anyone having the problem from the Hero side of the sync.

I'm running Windows Vista, have restarted PC and/or phone so many times and done a factory reset on the phone (which was a real pain and not something I fancy doing again!)

As the only thing I'm left with is that the sync software is faulty in the HTC and I'm facing sending the phone away or getting a new one - neither of which appeals

View 3 Replies View Related

HTC Desire : Force Close - Can Not Get Into Sence

Oct 5, 2010

I have been using LP for awhile now and now I can not get into Sence ? It keeps force closing before I can get in. Has anyone else have this problem ?

View 2 Replies View Related

General :: Most Apps Force Close?

Nov 16, 2012

Last night, one of my apps, flow free, wasn't working properly, and then it forced closed, then I think most of my apps did, like Samsung homepage, gmail, software update, android phone, log provider etc. I have a Samsung galaxy y Gt-S5360T, I haven't changed anything like ROM so I think it will still be in stock rom. After these apps have forced closed, it will turn off, we'll more its like it just turns itself on again. And then the problem just starts over. While this is happening, I can't really do anything, well when the force close thing isn't up, then sometimes I can start going into things, but never get a chance to do anything because the force close things either take me back to the home menu, or it turns off, sometimes, instead of having apps on the first page, and the call log, contact book, and messaging on the bottom, it just has the menu key, that's it. And even when I haven't unlocked it, it turns itself off and on again.

My SIM card had a problem, so I recently changed that to a blank and had it working with my old number and balance. And because of this, it was last night, I saved my contacts to my phone, rather than my SIM card.

Is there any way of fixing this( have already tried turning it off and on, and taking the battery out and putting it back in again) without losing my photos, songs, saved messages and contacts? And if not, is there any way of saving them to something else, even though my phone won't let me do anything? So what can I do?

View 1 Replies View Related

Copyrights 2005-15, All rights reserved