adding attachment to gmail app with intent
<p>I have an application which open pdf file with tap on app (default PDF in raw folder), openwith (myapp) and also from mail attachment. I converted the selected PDF file into inputstream and then to bytearray. Now I have a button and when user click on it need to send email through gmail app using intent. I need to add inputstream or bytearray as pdffile to the mail as attachment.I used the following code I can see the attachment with no bytes and received email donot have attachment. Struggling from more than 10 hours.. please help...</p>

<pre><code>     Intent sendIntent = new Intent(Intent.ACTION_VIEW);
                sendIntent.setType("application/pdf");
                sendIntent.setData(Uri.parse("sample@gmailcom"));
                sendIntent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail");
                sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "sample@gmail.com" });
                sendIntent.putExtra(Intent.EXTRA_SUBJECT, "testPDF");
                sendIntent.putExtra(Intent.EXTRA_TEXT, "this is a PDF ");


                File fileIn = new File(name, "myfile.pdf");
                Toast.makeText(this, fileIn.getName(), Toast.LENGTH_LONG).show();
                Uri fileuri = Uri.fromFile(fileIn);
                sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(fileuri.toString()));

                startActivity(sendIntent);
</code></pre>