简体   繁体   中英

Android how to get a json using 3g connection?

I'am trying to get a json file from a server using thread. with wifi I hav e no problem but when I switch to 3G, with my samsung galaxy s3 with an android version 4.1.2 I have no problem but with a samsung galaxy s4 android version 4.2.2 connection takes long (without printing a problem of connection) when I use browser for the some link, I have no problem. My code is given below :

How are you retrieving the JSON? it could be timing out on your 3g connection. i would suggest checking if you can increase the time it takes for a connection to timeout.

If you're using a WebView this might help. https://stackoverflow.com/a/7772884/856406

Try using AsynTask... http://developer.android.com/reference/android/os/AsyncTask.html

If its taking long time show progressdialog in preexecute

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM