Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6003713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:09:38+00:00 2026-05-23T01:09:38+00:00

I run into a NetworkOnMainThreadException with my Android 3.0 app. Searching for a solution

  • 0

I run into a NetworkOnMainThreadException with my Android 3.0 app.
Searching for a solution I found this, but if I understand this correctly, default setting would be that the strict mode is turned off.

Also, all my network access is in an AsyncTask, so I don’t see the point in this Exception anyway.

So, I’m quite desperate now what I should do to prevent this…

Kind regards,
jellyfish

Edit:

This blog entry says that AsyncTask should be enough, but at least clarifies the StrictMode point.

Solution:

I turned off the StrictMode (its probably better to keep some settings but I couldn’t be bothered…):

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);

After that, I did run into a “java.lang.RuntimeException: This thread forbids HTTP requests”, but found a solution for this here. I’m a bit confused, though, as AndroidHttpClient worked fine when I used it in my Android 2.0+ app…

Solution, part2

As it turned out, using AsyncTask was a nice idea but pretty useless if done wrong…
So there was nothing wrong with the strict mode’s reaction. Should have listened, er? 😉

Still good to know it’s activated on Honeycomb by default.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:09:38+00:00Added an answer on May 23, 2026 at 1:09 am

    StrictMode is turned on by default in Honeycomb.

    See say link specifically penaltyDeathOnNetwork(). I ran into a similar problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone run into this? I realize that 1.6 is the default on OS X,
Now I'm solving the android.os.NetworkOnMainThreadException I put the connect method into separated thread, but
I run into similar codes like this all the time in aspx pages: <asp:CheckBox
I run into this quite often where a new page is supposedly tested and
Has anyone run into this error message before when using a timer on an
I run into this frequently enough that I thought I'd see what others had
I run into this problem System.InvalidCastException: Unable to cast object of type 'System.Data.Linq.DataQuery 1[Student]'
I run into this problem a lot when making grids of thumbnails, etc. When
I run into a little problem today. I've a divbox. This divbox should expand
I run into this problem constantly while developing AJAX applications. Let's say I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.