我寫在我試圖用一些數據發送電子郵件的應用程序,但每當我做點擊提交按鈕發送一封電子郵件,越來越:不幸的是應用程序已停止android.content.ActivityNotFoundException使用意向
錯誤:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND typ=text/plain (has extras) }
代碼:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
String aEmailList[] = { "[email protected]" };
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body.toString()));
startActivity(emailIntent);
logcat的:
08-01 08:34:22.518: E/AndroidRuntime(1043): FATAL EXCEPTION: main
08-01 08:34:22.518: E/AndroidRuntime(1043): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SENDTO typ=text/plain (has extras) }
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.app.Activity.startActivityForResult(Activity.java:3370)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.app.Activity.startActivityForResult(Activity.java:3331)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.app.Activity.startActivity(Activity.java:3566)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.app.Activity.startActivity(Activity.java:3534)
08-01 08:34:22.518: E/AndroidRuntime(1043): at app.my.BookAppointmentActivity$6.onClick(BookAppointmentActivity.java:206)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.view.View.performClick(View.java:4204)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.view.View$PerformClick.run(View.java:17355)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.os.Handler.handleCallback(Handler.java:725)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.os.Handler.dispatchMessage(Handler.java:92)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.os.Looper.loop(Looper.java:137)
08-01 08:34:22.518: E/AndroidRuntime(1043): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-01 08:34:22.518: E/AndroidRuntime(1043): at java.lang.reflect.Method.invokeNative(Native Method)
08-01 08:34:22.518: E/AndroidRuntime(1043): at java.lang.reflect.Method.invoke(Method.java:511)
08-01 08:34:22.518: E/AndroidRuntime(1043): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-01 08:34:22.518: E/AndroidRuntime(1043): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-01 08:34:22.518: E/AndroidRuntime(1043): at dalvik.system.NativeStart.main(Native Method)
測試在模擬器或設備? –
@TheReader在模擬器 – Sneha
如果可能,嘗試在設備測試。 –