我想使用Intent发送电子邮件。但是,当我为此操作选择Gmail时,我会
致命异常:SyncAdapterThread-1流程:com.google.android.gm, PID:9855 java.lang.NullPointerException at android.content.ContentResolver.openInputStream(ContentResolver.java:613) 在com.google.android.gm.provider.aV.b(SourceFile:6237)at com.google.android.gm.provider.bh.HC(SourceFile:4213)at com.google.android.gm.provider.bh。(SourceFile:4186)at com.google.android.gm.provider.bo.a(SourceFile:3898)at com.google.android.gm.provider.Operations.b(SourceFile:628)at com.google.android.gm.provider.aV.a(SourceFile:5936)at com.google.android.gm.provider.MailSync.a(SourceFile:899)at com.google.android.gm.provider.MailEngine.a(SourceFile:2399)at com.google.android.gm.provider.MailEngine.a(SourceFile:2129)at com.google.android.gm.provider.bp.a(SourceFile:127)at com.google.android.common.b.onPerformSync(SourceFile:33)at com.google.android.gm.provider.bp.onPerformSync(SourceFile:82)at at android.content.AbstractThreadedSyncAdapter $ SyncThread.run(AbstractThreadedSyncAdapter.java:259)
答案 0 :(得分:1)
你实现了这样的
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto","abc@gmail.com", null));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "EXTRA_SUBJECT");
startActivity(Intent.createChooser(emailIntent, "Send email..."));
希望这会有所帮助。