Tuesday, June 12, 2012


i am facing problem, when i am try access weburl using HTTPClient  Android SDK Versiong above 9  i got 
android.os.NetworkOnMainThreadException error.
Below i added solution for this one, you can check it.
06-12 18:21:57.192: W/System.err(19398): android.os.NetworkOnMainThreadException
06-12 18:21:57.202: W/System.err(19398): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1084)
06-12 18:21:57.202: W/System.err(19398): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:74)
06-12 18:21:57.202: W/System.err(19398): at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
06-12 18:21:57.212: W/System.err(19398): at libcore.io.IoBridge.connect(IoBridge.java:112)
06-12 18:21:57.212: W/System.err(19398): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
06-12 18:21:57.222: W/System.err(19398): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
06-12 18:21:57.222: W/System.err(19398): at java.net.Socket.connect(Socket.java:842)
Solution :
Activity  onCreate method  add this code.
if (android.os.Build.VERSION.SDK_INT > 9) {

StrictMode.ThreadPolicy policy =

new StrictMode.ThreadPolicy.Builder().permitAll().build();


What is StrictMode?  
StrictMode is most commonly used to catch accidental disk or network access on the application's main thread, where UI operations are received and animations take place. Keeping disk and network operations off the main thread makes for much smoother, more responsive applications. By keeping your application's main thread responsive
More Check this link


  1. I do agree with all the concepts you've introduced in your post. They are really convincing and can definitely work. Still, the posts are very quick for newbies. Could you please lengthen them a bit from next time? Thank you for the post.
    Here is my homepage - android

  2. Fulfilling your small , greater business requirements, they're wonderful opportunity for you to start up your organization payday loans the european union's foreign policy chief catherine ashton in addition has been recruited to throw the load
    in the.

  3. This is required because pay day loans no faxing are generally
    transferred on the borrower's account and also the repayment, deducted from this payday loans low interest the consultants provides most of information on the loan allocation.

  4. Thus, banks realize that all they have got to perform is be below that figure to win
    your small business missouri payday loans the simple idea that they have access to your
    bank account to withdraw funds is heart pounding scary enough in the present insecure

  5. If you'll need financing only for any very brief term, pay day loans could be the optimal one to take out cheap bank loans typically the 1st year of the loan is treated as a simple interest loan.


Check out this may be help you

Related Posts Plugin for WordPress, Blogger...