want to take a picture and save it as a file on the sd-card. All works 
fine, the camera starts, the pictures were taking, and saving. If i check 
the picturefolder on my device, i see the taken picute, but if i check the 
folder from another actvity, i cant see the taken pictures. The same, if i 
check the folder from my pc. What is wrong with my code?


public static final String PHOTO_ALBUM = "/MyIdea/IdeaGallery/";
//Init ImageView
    mPhotoCapturedImageView = (ImageView) findViewById(R.id.imgViewThumbNail);

    Intent intent = new 
Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    startActivityForResult(intent, ACTIVITY_START_CAMERA_APP);

}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == ACTIVITY_START_CAMERA_APP && resultCode == RESULT_OK) {

        Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
        mPhotoCapturedImageView.setImageBitmap(thumbnail);

        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
        thumbnail.compress(Bitmap.CompressFormat.JPEG, 100, bytes);

        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new 
Date());
        String imageFileName = "IMAGE_" + timeStamp+ "_";

        File file = new File(Environment.getExternalStorageDirectory()+ 
PHOTO_ALBUM + imageFileName + ".jpg");
        try {
            file.createNewFile();
            FileOutputStream fo = new FileOutputStream(file);
            //5
            fo.write(bytes.toByteArray());
            fo.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
...




-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/2cec82c6-f81b-4747-9435-e1c717f110df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to