Question

EDIT: The solution Hiren gave worked. Thank you so much!For those that are having similar issues, follow these instructions and also look at this: Android Honeycomb: NetworkOnMainThreadException even when using AsyncTask and no strict mode?

Thanks once again!

I'm developing an app for the galaxy tab and I am unable to send emails from the tab. The code I've found works elsewhere (including my phone) but it does not work on the tab.

The exception I get when I try to send mails through javamail is something like this:

not loading file: /system/lib/javamail.providers

I tried to use the solution suggested below and I got the following exception:

01-21 14:30:14.340: E/MailApp(3515): Could not send email
01-21 14:30:14.340: E/MailApp(3515): android.os.NetworkOnMainThreadException
01-21 14:30:14.340: E/MailApp(3515):    at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1077)
01-21 14:30:14.340: E/MailApp(3515):    at java.net.InetAddress.lookupHostByName(InetAddress.java:477)
01-21 14:30:14.340: E/MailApp(3515):    at java.net.InetAddress.getLocalHost(InetAddress.java:445)
01-21 14:30:14.340: E/MailApp(3515):    at javax.mail.internet.InternetAddress.getLocalAddress(InternetAddress.java:517)
01-21 14:30:14.340: E/MailApp(3515):    at javax.mail.internet.UniqueValue.getUniqueMessageIDValue(UniqueValue.java:99)
01-21 14:30:14.340: E/MailApp(3515):    at javax.mail.internet.MimeMessage.updateMessageID(MimeMessage.java:2054)
01-21 14:30:14.340: E/MailApp(3515):    at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2076)
01-21 14:30:14.340: E/MailApp(3515):    at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2042)
01-21 14:30:14.340: E/MailApp(3515):    at javax.mail.Transport.send(Transport.java:117)
01-21 14:30:14.340: E/MailApp(3515):    at android.app.Mail.send(Mail.java:136)
01-21 14:30:14.340: E/MailApp(3515):    at android.app.ConfirmationActivity.onSubmit(ConfirmationActivity.java:151)
01-21 14:30:14.340: E/MailApp(3515):    at java.lang.reflect.Method.invokeNative(Native Method)
01-21 14:30:14.340: E/MailApp(3515):    at java.lang.reflect.Method.invoke(Method.java:491)
01-21 14:30:14.340: E/MailApp(3515):    at android.view.View$1.onClick(View.java:2695)
01-21 14:30:14.340: E/MailApp(3515):    at android.view.View.performClick(View.java:3127)
01-21 14:30:14.340: E/MailApp(3515):    at android.view.View$PerformClick.run(View.java:12025)
01-21 14:30:14.340: E/MailApp(3515):    at android.os.Handler.handleCallback(Handler.java:587)
01-21 14:30:14.340: E/MailApp(3515):    at android.os.Handler.dispatchMessage(Handler.java:92)
01-21 14:30:14.340: E/MailApp(3515):    at android.os.Looper.loop(Looper.java:132)
01-21 14:30:14.340: E/MailApp(3515):    at android.app.ActivityThread.main(ActivityThread.java:4126)
01-21 14:30:14.340: E/MailApp(3515):    at java.lang.reflect.Method.invokeNative(Native Method)
01-21 14:30:14.340: E/MailApp(3515):    at java.lang.reflect.Method.invoke(Method.java:491)
01-21 14:30:14.340: E/MailApp(3515):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
01-21 14:30:14.340: E/MailApp(3515):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
01-21 14:30:14.340: E/MailApp(3515):    at dalvik.system.NativeStart.main(Native Method)

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top