Android / Java.io.IOException(313)

时间:2011-03-10 20:26:55

标签: java android ioexception

我正在使用以下代码从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中工作得很好......

有什么想法吗?

由于 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 = "someaddr@myplace.com";
        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());
        }

    }

1 个答案:

答案 0 :(得分:0)

修复模拟器;添加:

-dns-server XXXX(你知道的一些声音dns服务器;可能是8.8.8.8) 命令行,修复Eclipse右键单击

  

项目>运行方式>运行配置>目标>其他仿真器命令行选项

并将其添加到那里。