January 16, 2015

android.os.NetworkOnMainThreadException

android.os.NetworkOnMainThreadException  is an android runtime exception which occurs when you are trying to run any network or IO related operations from main activity. Android doesn't support to run IO operations directly on the main activity. 

So to avoid this exception, use a thread to do these operations or you can also use AsyncTask class which helps you to run the code in the background.

3 comments:

  1. Android 5.1 isn't one of those massive life-changing releases that'll have you tapping the 'look for updates' button frenetically for days on end. To know more, Visit Android training in Bangalore

    ReplyDelete
    Replies
    1. Great Article android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Android lollilop is the best versions in android. we are one of the best android training institute in chennai. our training adapts to the latest version of android.

    ReplyDelete