How to cancel DefaulHttpClient execution process in multithread

后端 未结 4 1159
北恋
北恋 2021-01-03 17:14

I am developing an android application that rely very much on internet, I retrieve data frequently using this RestClient Class, that wrap some detail on using DefaultHttpCli

4条回答
  •  臣服心动
    2021-01-03 17:32

    Use the threading primitives. Have a flag running and set it to true initially. Do your REST requests in a while(running) loop.

    In your onPause(), set the running flag to false.

提交回复
热议问题