I have the entire code here .
Below are the important stuff.The problem is:I have the camera take a picture when i tap on the surface and store the image to sdcard.If i click 2 or more times before the camera stores the picture the camera freezes and the phone need a restart.I think i have all the release stuff correct.I even implemented a boolean onProgress
to take some action but it seams it doesn't work. Any help would be .. you know... helpfull :P
Thank you
public void onClick() {
if(!onProgress)
mCamera.takePicture(null, mPictureCallback, mPictureCallback);
}
Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
public void onPictureTaken(byte[] imageData, Camera c) {
onProgress=true;
if (imageData != null) {
Intent mIntent = new Intent();
try {
FileOutputStream out = new FileOutputStream(
"/sdcard/Deltio1.jpg");
Bitmap e = BitmapFactory.decodeByteArray(imageData, 0,
imageData.length);
e.compress(Bitmap.CompressFormat.JPEG, 65, out);
out.close();
Intent i = new Intent(ACT, MediaSend.class);
ACT.startActivity(i);
} catch (Exception e) {
Toast
.makeText(
CON,
"Πρόβλημα στην αποθήκευση.Βεβαιωθείτε ότι έχετε sdcard εγκατεστημένη",
Toast.LENGTH_LONG).show();
ACT.finish();
}
// FileUtilities.StoreByteImage(mContext, imageData,
// 50, "ImageName");
SystemClock.sleep(2000);
mCamera.startPreview();
onProgress=false;
// setResult(FOTO_MODE,mIntent);
// finish();
}
}
};