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

  • Home
  • SEARCH
  • 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

I frequently run into problems of this form and haven't found a good solution
I have run into this issue several times in the past and would like
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 problem constantly while developing AJAX applications. Let's say I want
I run into this problem periodically, and I'm trying to figure out if it's
I run into design choices like this often and struggle a bit; I'm looking
I run into a very strange problem in my C# 2.0 WinForms app and
I have run into an issue with JQuery form submissions and have found no

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.