Quantcast
Channel: How can I fix 'android.os.NetworkOnMainThreadException'? - Stack Overflow
Viewing all articles
Browse latest Browse all 191

Answer by msysmilu for How can I fix 'android.os.NetworkOnMainThreadException'?

$
0
0

Although above there is a huge solution pool, no one mentioned com.koushikdutta.ion: https://github.com/koush/ion

It's also asynchronous and very simple to use:

Ion.with(context).load("http://example.com/thing.json").asJsonObject().setCallback(new FutureCallback<JsonObject>() {   @Override    public void onCompleted(Exception e, JsonObject result) {        // do stuff with the result or error    }});

Viewing all articles
Browse latest Browse all 191

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>