Android/Java.io.IOException(313)
我使用以下代码从 Android2.2 应用程序发送电子邮件,它抛出此异常:
03-10 12:36:31.161: ERROR/SendTransaction(313): java.io.IOException: Cannot establish route to 0 for null
这只是在我切换到 MyEclipse for Spring 8.6 时开始的。在 Eclipse Galileo 中工作得很好...
有什么想法吗?
谢谢 尼蒙
private void SendMail(String mySubject, String myContent){
final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
//intent.addCategory(Intent.CATEGORY_DEFAULT);
final String someEmailAddressString = "[email protected]";
final String someSubjectString = mySubject;
final String someEmailContentString = myContent;
try{
//intent.setType("plain/text"); //Throws no e-mail present in emulator
intent.setType("image/jpeg"); //This works for testing
//intent.addCategory(Intent.CATEGORY_DEFAULT);
//intent.getAction();
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{someEmailAddressString});
intent.putExtra(Intent.EXTRA_SUBJECT, someSubjectString);
intent.putExtra(Intent.EXTRA_TEXT, someEmailContentString);
//startActivity(intent);
startActivity(Intent.createChooser(intent, "Send mail"));
Toast.makeText(TimeCard.this, "Sending-"+ mySubject, Toast.LENGTH_LONG).show();
}catch(Exception e){
final String DEBUG_ERR = "SENDMAIL";
Log.e(DEBUG_ERR, "Basic-" + e.getMessage().toString());
}
}
I am using the following code to send an e-mail from an Android2.2 app it is throwing this exception:
03-10 12:36:31.161: ERROR/SendTransaction(313): java.io.IOException: Cannot establish route to 0 for null
This just started when I switched to MyEclipse for Spring 8.6. Worked fine in Eclipse Galileo...
Any ideas?
Thanks
Neomon
private void SendMail(String mySubject, String myContent){
final Intent intent = new Intent(android.content.Intent.ACTION_SEND);
//intent.addCategory(Intent.CATEGORY_DEFAULT);
final String someEmailAddressString = "[email protected]";
final String someSubjectString = mySubject;
final String someEmailContentString = myContent;
try{
//intent.setType("plain/text"); //Throws no e-mail present in emulator
intent.setType("image/jpeg"); //This works for testing
//intent.addCategory(Intent.CATEGORY_DEFAULT);
//intent.getAction();
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{someEmailAddressString});
intent.putExtra(Intent.EXTRA_SUBJECT, someSubjectString);
intent.putExtra(Intent.EXTRA_TEXT, someEmailContentString);
//startActivity(intent);
startActivity(Intent.createChooser(intent, "Send mail"));
Toast.makeText(TimeCard.this, "Sending-"+ mySubject, Toast.LENGTH_LONG).show();
}catch(Exception e){
final String DEBUG_ERR = "SENDMAIL";
Log.e(DEBUG_ERR, "Basic-" + e.getMessage().toString());
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在模拟器中修复;添加:
-dns-server XXXX
(您知道的一些健全的 dns 服务器;可能是 8.8.8.8)到命令行,在 Eclipse 中右键单击修复
并将它们添加到那里。
To fix in the emulator ; add :
-dns-server XXXX
(some sound dns server you know of; may be 8.8.8.8)to command line, to fix in Eclipse rightClick
and add them there.