-4

I want to execute Asynctask only for 3 minutes. After 3 minutes it should be terminate. Please guide.

  • 2
    Possible duplicate of [Android - Setting a Timeout for an AsyncTask?](http://stackoverflow.com/questions/7882739/android-setting-a-timeout-for-an-asynctask) – ThomasThiebaud Oct 09 '15 at 08:49

1 Answers1

0

You can set a timeout for an asynctask. Somethink like :

asyncTask.get(3, TimeUnit.MINUTES);

See this thread

Community
  • 1
  • 1
ThomasThiebaud
  • 11,331
  • 6
  • 54
  • 77
  • thanks for responding. but actually i am executing asynctask inside onPostExecute() of same asynctask again and again. and i want this process works for 3 minutes only – AndroidOne Oct 09 '15 at 09:56