Never run a network call on a UI thread
Network calls take time and may cause a delay
Written by Nischal.
Related protips
7 Responses
Also, please try to avoid disk I/O on a UI thread as well :)
over 1 year ago
·
Async right?
over 1 year ago
·
@drabiter Async ??? any network calls may cause a delay...earlier versions of android allowed this, but newer versions will throw a "network on main thread" exception
over 1 year ago
·
@dpashkevich Yes I/O calls too may take time hampering user experience!!!
over 1 year ago
·
@nischee I mean, Async class as the solution :)
over 1 year ago
·
@drabiter yes Async class is a solution!!! :)
over 1 year ago
·
In Android 4 it is not possible to execute network calls in UI thread because system throws NetworkOnMainThreadExteption. :)
http://developer.android.com/reference/android/os/NetworkOnMainThreadException.html
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Android
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#