i am sending email intent from my app to send a mail through email clients.
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", to[0], null));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT, body);
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);
My attachment uri content://com.test/logs/test.log
My intent chooser shows the native android email client and gmail client.
I have already asked my questions here but no reply :(
http://productforums.google.com/forum/#!mydiscussions/gmail/3ivhRlbmXc8
Error while sending email with attachment in gmail android app
email client works fine but when i select gmail client it crashes.Below is the stacktrace. The to address is actually empty
01-16 18:35:37.670: E/AndroidRuntime(6147): FATAL EXCEPTION: main
01-16 18:35:37.670: E/AndroidRuntime(6147): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gm/com.google.android.gm.ComposeActivityGmail}: java.lang.NullPointerException
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.os.Looper.loop(Looper.java:137)
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.app.ActivityThread.main(ActivityThread.java:5103)
01-16 18:35:37.670: E/AndroidRuntime(6147): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 18:35:37.670: E/AndroidRuntime(6147): at java.lang.reflect.Method.invoke(Method.java:525)
01-16 18:35:37.670: E/AndroidRuntime(6147): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
01-16 18:35:37.670: E/AndroidRuntime(6147): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-16 18:35:37.670: E/AndroidRuntime(6147): at dalvik.system.NativeStart.main(Native Method)
01-16 18:35:37.670: E/AndroidRuntime(6147): Caused by: java.lang.NullPointerException
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.content.ContentResolver.acquireExistingProvider(ContentResolver.java:1116)
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.content.ContentResolver.getType(ContentResolver.java:257)
01-16 18:35:37.670: E/AndroidRuntime(6147): at com.android.mail.compose.AttachmentsView.m(SourceFile:217)
01-16 18:35:37.670: E/AndroidRuntime(6147): at com.android.mail.compose.ComposeActivity.a(SourceFile:672)
01-16 18:35:37.670: E/AndroidRuntime(6147): at com.android.mail.compose.ComposeActivity.zW(SourceFile:583)
01-16 18:35:37.670: E/AndroidRuntime(6147): at com.android.mail.compose.ComposeActivity.onCreate(SourceFile:445)
01-16 18:35:37.670: E/AndroidRuntime(6147): at com.google.android.gm.ComposeActivityGmail.onCreate(SourceFile:54)
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.app.Activity.performCreate(Activity.java:5133)
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
01-16 18:35:37.670: E/AndroidRuntime(6147): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
01-16 18:35:37.670: E/AndroidRuntime(6147): ... 11 more
Thanks and Regards, Saurav