How to SAVE Pic

All your problems with Audio, Video and Images.

How to SAVE Pic

Postby doubleslash » Fri Mar 06, 2009 8:09 pm

I want to save a picture taken by the camera. In my surfaceView which shows the camera preview, I have onPictureTaken implemented as follows
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. @Override
  3.                 public void onPictureTaken(byte[] data, Camera camera) {
  5.                         // TODO Auto-generated method stub
  7.                          Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
  9.                         MediaStore.Images.Media.insertImage(context.getContentResolver(), bmp, "pic", "pic");
  11. }
Parsed in 0.013 seconds, using GeSHi
This throws some kind of exception, not sure how to get a handle on that. Then, I wrote a separate app just to save a bitmap using the same MediaStore syntax. After running the app, I open the Pictures folder on the device, and get the message that goes like Camera class has been terminated. I can find the pic after restarting my phone though. From searching here and the google discussion groups, I got the impression that saving a pic is a big can of worms. But there's got to be a way to do it. The native camera app can do it. Can someone help please?
Posts: 30
Joined: Fri Feb 13, 2009 6:05 am


Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 4 guests