KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
By default, files saved to the internal storage are private to your application and other applications cannot access them (nor can the user). I am able to see the file "/data/data/package_name/files/ in file explore in DDMS, but when i attached the above file URI using imageUri in email , then i saw that attached file is of 0kb. i have used the default email APIs of Android. Can anyone suggest me ,how to attach a file in email that is private to the application? although i am successful able to save the file in SD card and attaching the file from SD card , this is working fine. But if SD card is not available and saving the file to the internal storage , then how can i attach them in email. String FILENAME = "hello_file.txt"; String string = "hello world!";FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE); fos.write(string.getBytes()); fos.close(); File imageFile = getFileStreamPath(FILENAME ); Uri imageUri = Uri.fromFile(imageFile); final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("*/*"); emailIntent.putExtra(android.content.Intent.EXTRA_STREAM,imageUri); this.startActivityForResult(Intent.createChooser(emailIntent, "Send mail..."),SUB_ACTIVITY);
Tags (comma-separated)
Save Edits
Cancel