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 8688821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:28:30+00:00 2026-06-12T23:28:30+00:00

I developed the app That is working fine in before android 4.0.0 versions. But

  • 0

I developed the app That is working fine in before android 4.0.0 versions. But in android 4.0.0 + versions it getting force close. It say network on main thread exception

  • 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-06-12T23:28:31+00:00Added an answer on June 12, 2026 at 11:28 pm

    The reason why your application crashes on Android versions 3.0 and above, but works fine on Android 2.x is because HoneyComb Ice Cream Sandwich and Jelly Bean are much stricter about abuse against the UI Thread. For example, when an Android device running HoneyComb or above detects a network access on the UI thread, a NetworkOnMainThreadException will be thrown:

    E/AndroidRuntime(673): java.lang.RuntimeException: Unable to start activity
    ComponentInfo{com.example/com.example.ExampleActivity}:android.os.NetworkOnMainThreadException
    

    The explanation as to why this occurs is well documented on the Android developer’s site:

    A NetworkOnMainThreadException is thrown when an application attempts to perform a networking operation on its main thread. This is only thrown for applications targeting the Honeycomb SDK or higher. Applications targeting earlier SDK versions are allowed to do networking on their main event loop threads, but it’s heavily discouraged.
    Some examples of other operations that JellyBean,ICSandHoneyComb and “ won’t allow you to perform on the UI thread are:

    1. Opening a Socket connection (i.e. new Socket()).
    2. HTTP requests (i.e. HTTPClient and HTTPUrlConnection).
    3. Attempting to connect to a remote MySQL database.
    4. Downloading a file (i.e. Downloader.downloadFile()).

    If you are attempting to perform any of these operations on the UI thread, you must wrap them in a worker thread. The easiest way to do this is to use of an AsyncTask, which allows you to perform asynchronous work on your user interface. An AsyncTask will perform the blocking operations in a worker thread and will publish the results on the UI thread, without requiring you to handle threads and/or handlers yourself.

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

Sidebar

Related Questions

I have developed an app that in testing has worked fine but when it
I developed an app that is working fine on windows phone. The nature of
i've developed an android app that's fetches an xml file and displays this data
I have developed an App that target version is 4 (Android 1.6) upto 7
I have developed an android app that automatically sends an SMS automatically to a
I have implemented the search bar in my app and it´s working fine, but
I am working on an Android app that displays photos which are downloaded from
I have developed a WCF service that has been working fine for a few
I have developed an Android Widget, and it was working fine. I added some
I'm working as a developer, curently mantaining a VB6 app that desperately needs to

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.