Sharing Text File using ACTION_SEND
android
Solution
Use the following line.
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("*/*");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {"me@gmail.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"Test Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
"go on read the emails");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromfile(new File(yourtextfilepath));
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
Make sure that your text file path should be from external memory card. Action send wont accept the files from internal memory.
Hope this will help you.
Problem
We can open share dialog using ACTION_SEND to share text ``` Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "Download Link: Android play store link"); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, "Share This App")); ``` How can I use ACTION_SEND to share a text file. I read http://developer.android.com/training/sharing/send.html but could not get how to share text file.