Skip to content Skip to sidebar Skip to footer

Sharing Text File Using Action_send

We can open share dialog using ACTION_SEND to share text Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND);

Solution 1:

Use the following line.

IntentemailIntent=newIntent(android.content.Intent.ACTION_SEND); 
    emailIntent.setType("*/*");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, newString[] {"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(newFile(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.

Post a Comment for "Sharing Text File Using Action_send"