Hello Everyone,
Please help me in displaying picture taken from camera on G1 device. Camera
preview display and canvas to draw picture should use the same surface
holder (mHolder).


Camera camera = Camera.open();

if (camera != null) {

try {

  camera.setPreviewDisplay(mHolder);

} catch (IOException e) {

e.printStackTrace();}


camera.startPreview();


Camera.PictureCallback cb = new Camera.PictureCallback() {


   public void onPictureTaken(byte[] data, Camera camera) {


     camera.startPreview();

     Bitmap b= Bitmap.createScaledBitmap(BitmapFactory.decodeByteArray(data,
0, data.length, null),320, 240, true);

     SurfaceHolder holder = mHolder;

     Canvas canvas = holder.lockCanvas();

     canvas.drawBitmap(b, 0, 0, null);

     holder.unlockCanvasAndPost(canvas);

   }

};

 camera.takePicture(null, null, cb);


This piece of code is running well on emulator. But when run on G1, a black
screen is displayed :(

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to