Android: How to set a HTTP connection timeout and react to it?

后端 未结 2 889
感情败类
感情败类 2020-12-21 12:51

I am working on an Android app that needs to read a line from a web page right when it starts. I am doing this with the following code:

try{
        URL url          


        
2条回答
  •  忘掉有多难
    2020-12-21 13:38

    Consider using AndroidHttpClient class instead, it has nice preset timeouts so you wouldn't have to do anything.

提交回复
热议问题