您好我正在开发的地方,当我试图从我的应用程序发送电子邮件我面对这个错误的Android应用。我在后台发送邮件,而无需使用基于这个意图链接
Hi I am developing an android application where I face this error when I try to send Email from my app. I am sending mail at the background without using intent based on this link
我的程序:
String em[] = {gete(u, e)};
MailSender sender = new GMailSender(
"email id",
"password");
sender.sendMail("Sub", "Body", "from address",""+em[0]);
move();
}
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show();
}
}
}).start();
}
});
当我直接指定收件人的电子邮件地址申请工作正常。问题是当我将它指定为字符串数组,其中我存储收件人的电子邮件地址。
Application works fine when I specify the recipient's email address directly. Problem comes when I specify it as string array where I stored recipients email addresses.
LogCat中所示:
Logcat shows :
跳过222帧!该应用程序可能会做它的主线程的工作太多了。
Skipped 222 frames! The application may be doing too much work on its main thread.
谁能告诉我什么是确切的问题?
Can anyone tell me what is the exact problem ?
推荐答案
,因为它是你说的,你做了太多的事情。因此,使用一个线程来执行你发送的动作:
As it is said to you, you're doing too much things. So use a thread to execute your send action:
new Thread(new Runnable() {
public void run() {
try {
sender.sendMail("Sub", "Body", "from address",""+em[0]);
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show();
}
}).start();
相关推荐
最新文章