Intent sendIntent = new Intent(Intent.ACTION_VIEW); sendIntent.setType("application/pdf"); sendIntent.setData(Uri.parse("testuurmi@gmail.com")); sendIntent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail"); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "testuurmi@gmail.com" }); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "testPDF"); sendIntent.putExtra(Intent.EXTRA_TEXT, "this is a PDF "); File pdfFile=null; try { pdfFile = new File(attachmentFileName); FileOutputStream fos = new FileOutputStream(pdfFile); fos.write(bytes); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Uri fileuri = Uri.fromFile(pdfFile); sendIntent.putExtra(Intent.EXTRA_STREAM, fileuri); //start the gmailapp intent startActivity(sendIntent);
please replace <pre>new Intent(Intent.ACTION_VIEW);
new Intent(Intent.ACTION_SEND);
sendIntent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail");
sendIntent.setPackage("com.google.android.gm");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)