Link to solution/workaround at bottom of question
I used the Android tutorial to write code to open the nexus 7 camera via intents and take a photo. It refused to work properly unless I altered the file object initialisation code from
File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), "MyCameraApp");
to
File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES)
+ File.separator
+"MyCameraApp");
and even then intent.getData()
is still null when onActivityResult
is called. Back to the question at hand though: I can see the saved image browsing on the tablet itself, but not when I browse it on the PC via USB.
What am I doing wrong? I thought using getExternalStoragePublicDirectory
made files completely accessible. Could there be something else wrong with my code? Do I need to somehow "tell" the stock camera app to save it as MODE_WORLD_READABLE
or something along those lines?
Spent hours and hours trying to get this working properly - any help would be appreciated!
I can post the rest of my code if it would help - its almost identical to the Android tutorial though.
EDIT: This is caused by a known problem with the nexus 7 and 4. See 2nd link for solution
Saving files on external storage on Nexus 7 and retrieving from PC