Hello I'm trying to make a photo calling the CAMERA Intent an after
returning to my application read the file, but altough I get a File
like /sdcard/DCIM/camera/XXXX.jpg if I try to open the file, it exist
and can be read (check with File.exist or File.canread BUT the length
of the file is always 0...

More or less my code is:
call the camera intent like:
Uri imageUri =
getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
values);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE)

in the onActivityResult I do this:

get the File from the Uri, something like (cut&paste from internet):
                Cursor cursor = null;
                try {
                    String [] proj={MediaStore.Images.Media.DATA,
MediaStore.Images.Media._ID,
MediaStore.Images.ImageColumns.ORIENTATION};
                    cursor = activity.managedQuery( imageUri, proj, null, null,
null);
                    int file_ColumnIndex =
cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
                    int orientation_ColumnIndex =
cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.ORIENTATION);
                    if (cursor.moveToFirst()) {
                        String orientation =
cursor.getString(orientation_ColumnIndex);
                        return new File(cursor.getString(file_ColumnIndex));
                    }
                    return null;
                } finally {
                    if (cursor != null) {
                        cursor.close();
                    }
                }

So I get a File like /sdcard/DCIM/Camera/XXXXXXXXX.jpg
So if I do:
file.exists()  --> true
file.canRead() --> true
file.length()  --> 0 !!!
So I cant read the file from sdcard (if I try to ignore the size and
simply open a FileInputStream and read it reads of course 0 bytes...


So where is the problem?
I'm stuck on this...

Best regards.

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

Reply via email to