'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);
                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.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source