Android sharing Files, by sending them via email or other apps

Solution 1:

this is the code for sharing file in android

Intent intentShareFile = new Intent(Intent.ACTION_SEND);
File fileWithinMyDir = new File(myFilePath);

if(fileWithinMyDir.exists()) {
    intentShareFile.setType("application/pdf");
    intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+myFilePath));

    intentShareFile.putExtra(Intent.EXTRA_SUBJECT,
                        "Sharing File...");
    intentShareFile.putExtra(Intent.EXTRA_TEXT, "Sharing File...");

    startActivity(Intent.createChooser(intentShareFile, "Share File"));
}

Solution 2:

sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(exportPath));

also you can make zip file of all file and attach zip file for send multiple file in android