简体   繁体   English

Android / Java.io.IOException(313)

[英]Android/ Java.io.IOException(313)

I am using the following code to send an e-mail from an Android2.2 app it is throwing this exception: 我正在使用以下代码从Android2.2应用发送电子邮件,并引发此异常:

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. 当我切换到Spring 8.6的MyEclipse时,这才刚刚开始。 Worked fine in Eclipse Galileo... 在Eclipse Galileo上运行良好...

Any ideas? 有任何想法吗?

Thanks Neomon 谢谢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());
        }

    }

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 -dns-server XXXX (您知道的一些声音dns服务器;可能是8.8.8.8)到命令行,以在Eclipse中-dns-server XXXX进行修复

project > Run As > Run Configurations > target > additional Emulator command line options 项目>运行方式>运行配置>目标>其他模拟器命令行选项

and add them there. 并将它们添加到那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM