Greetings all, I've resorted to writing an image file to external storage in order to get the shared intent to work, but I'd much prefer letting users share images even without having an SD card mounted.
The following code fails when sharing with the Google Drive and Facebook apps: private final void shareImage() { Intent share; Uri imageURI; String defaultTitle; String filename; File cacheDirectory; File imageFile; cacheDirectory = getCacheDir(); filename = cacheDirectory.getAbsolutePath() + "/content.jpg"; imageFile = new File(filename); writeImageToPath(imageFile); imageURI = Uri.parse("file://" + imageFile.getAbsolutePath()); share = new Intent(Intent.ACTION_SEND); share.setType("image/jpg"); share.putExtra(Intent.EXTRA_SUBJECT, "Default Title"); share.putExtra(Intent.EXTRA_STREAM, imageURI); startActivity(Intent.createChooser(share, "Share diagram using")); } private void writeImageToPath(String aFilename) { Bitmap finalBitmap; File file; file = getFileStreamPath(aFilename); if(file.exists()) file.delete(); finalBitmap = bitmapOfDiagram(); try { FileOutputStream out = openFileOutput(aFilename, MODE_WORLD_READABLE); finalBitmap.compress(Bitmap.CompressFormat.JPEG, 90, out); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } } As you can see, I write the file with MODE_WORLD_READABLE, and the apps appear to send the file to their respective servers. However, they returns some time later reporting, "Upload failed - click to retry". Failure with both services leads me to question my code. Stepping through the results with the debugger shows no point of failure in the generation of the file nor in invoking the intent. As I mentioned before, I'd like to permit users to send images without requiring them to use an SD card to do it. Can someone point me in the right direction? Alfonso Guerra Apokalypse Software Corp. -- 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