Code example for Camera

Methods: startPreview

0
  }; 
 
  Camera.PictureCallback photoCallback=new Camera.PictureCallback() {
    public void onPictureTaken(byte[] data, Camera camera) { 
      new SavePhotoTask().execute(data); 
      camera.startPreview(); 
      inPreview=true; 
    } 
  }; 
 
  class SavePhotoTask extends AsyncTask<byte[], String, String> {
    @Override 
    protected String doInBackground(byte[]... jpeg) {
      File photo=
          new File(Environment.getExternalStorageDirectory(),
                   "photo.jpg"); 
 
      if (photo.exists()) {
        photo.delete();
      }