Error while sending email with attachment
<p>I have a problem that I want to send an email with image attachment but it always returns error while selecting Gmail option from the pop menu. I failed to find the reason behind the same. Please suggest me the right solution.</p>

<p><strong>Code:</strong></p>

<pre><code>Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Halosys Greetings");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,"");
emailIntent.putExtra(Intent.EXTRA_STREAM, bm);
emailIntent.setType("image/png");
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
</code></pre>

<p><strong>Error Stack:</strong></p>

<pre><code>12-28 11:42:37.456: ERROR/AndroidRuntime(21930): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gm/com.google.android.gm.ComposeActivity}: java.lang.NullPointerException
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at android.os.Looper.loop(Looper.java:123)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at android.app.ActivityThread.main(ActivityThread.java:4627)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at java.lang.reflect.Method.invokeNative(Native Method)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at java.lang.reflect.Method.invoke(Method.java:521)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at dalvik.system.NativeStart.main(Native Method)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930): Caused by: java.lang.NullPointerException
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at com.google.android.gm.provider.Gmail$AttachmentOrigin.localFileExtras(Gmail.java:2194)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at com.google.android.gm.ComposeArea.addAttachment(ComposeArea.java:732)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at com.google.android.gm.ComposeArea.initFromExtras(ComposeArea.java:685)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at com.google.android.gm.ComposeActivity.initFromExtras(ComposeActivity.java:1482)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at com.google.android.gm.ComposeActivity.finishOnCreateAfterAccountSelected(ComposeActivity.java:1021)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at com.google.android.gm.ComposeActivity.onCreate(ComposeActivity.java:259)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-28 11:42:37.456: ERROR/AndroidRuntime(21930):     ... 11 more
</code></pre>

<p>Thanks in advance.</p>
