I have an activity that starts a camera and after the picture is taken
it shows an alert dialog so user can choose save, cancel, retry. I
cannot seem to delete the picture data on cancel, nor transfer the
image to another activity, in the same app, on save. There is no error
showing, it just doesn't clear the data and I don't know how to access
the data to use in an imageview on the other activity. Here is the
relevant code:

PictureCallback jpegCallback = new PictureCallback() {
  @Override
  public void onPictureTaken(byte[] data, Camera c) {
                        tempdata = data;
                        done();
        }
};

void done() {
        Bitmap bm = BitmapFactory.decodeByteArray(tempdata,  0,
tempdata.length);
        final String url = Images.Media.insertImage(getContentResolver(), bm,
null, null);
                bm.recycle();
                Bundle bundle = new Bundle();
                if(url != null) {
                        bundle.putString("url", url);
                        Intent mIntent = new Intent();
                        mIntent.putExtras(bundle);
                        setResult(RESULT_OK, mIntent);
        }else{
        Toast.makeText(this, "Picture can not be saved",
Toast.LENGTH_SHORT).show();     }

AlertDialog dialog = new AlertDialog.Builder(this).create();

I have 3 buttons in the dialog, save, cancel, and retry.  The retry
works fine, I need to clear the data on cancel and recall the save
data in another activity if they choose save.

-- 
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