I tried many ways but i can't do this .
I have a *.txt file . i want share it via Bluetooth , wifi , email and ...
.
When i used this code i cant share the file:
File file = new File(Environment.getExternalStorageDirectory(), "Email-Ghap/Emails.txt");
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("*/txt");
sharingIntent.putExtra(Intent.EXTRA_STREAM, file);
startActivity(Intent.createChooser(sharingIntent, "share file with"));
Totally i want this : when user clicked on share button and choose one email sender like Gmail for sharing . the file must be attached file for new email ...
I found this link https://stackoverflow.com/a/16036249/4016922
But it share txt file content . i want to share file not content of txt file
Change your Code Like this.
From
To
from:
To
so yourFinal Code Looks Like