我正在尝试从后台从我的 android 应用程序发送电子邮件。邮件已成功发送并带有附件,但之后我仍然在日志中收到错误。这是日志,请指导我错误在哪里以及如何解决它。
03-14 13:37:37.697: E/MailApp(1296): Could not send email
03-14 13:37:37.697: E/MailApp(1296): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
03-14 13:37:37.697: E/MailApp(1296): at android.os.Handler.<init>(Handler.java:197)
03-14 13:37:37.697: E/MailApp(1296): at android.os.Handler.<init>(Handler.java:111)
03-14 13:37:37.697: E/MailApp(1296): at android.widget.Toast$TN.<init>(Toast.java:324)
03-14 13:37:37.697: E/MailApp(1296): at android.widget.Toast.<init>(Toast.java:91)
03-14 13:37:37.697: E/MailApp(1296): at android.widget.Toast.makeText(Toast.java:238)
03-14 13:37:37.697: E/MailApp(1296): at com.example.mytest.ReadContactsActivity.SendMail(ReadContactsActivity.java:173)
03-14 13:37:37.697: E/MailApp(1296): at com.example.mytest.ReadContactsActivity.access$0(ReadContactsActivity.java:156)
03-14 13:37:37.697: E/MailApp(1296): at com.example.mytest.ReadContactsActivity$CountDownTask.doInBackground(ReadContactsActivity.java:131)
03-14 13:37:37.697: E/MailApp(1296): at com.example.mytest.ReadContactsActivity$CountDownTask.doInBackground(ReadContactsActivity.java:1)
03-14 13:37:37.697: E/MailApp(1296): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-14 13:37:37.697: E/MailApp(1296): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-14 13:37:37.697: E/MailApp(1296): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-14 13:37:37.697: E/MailApp(1296): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-14 13:37:37.697: E/MailApp(1296): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)