Dave's Brain

Browse - Programming Tips - How can I avoid a crash because of "Network activity on main thread"?

Date: 2015may18
OS: Android

Q.  How can I avoid a crash because of "Network activity on main thread"?

A.  Of course you can make a thread and put the network stuff there.
But here's a trick.  You can set the target version to 9

<uses-sdk ... android:targetSdkVersion="9" />
In the manifest. And Android doesn't complain. Needless to say, its best not to make the user wait for network activity but if its a test app or the like then its no big deal.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.