0

Since I need to get String array from the Asyntask, I need to use the get() after the execute():

String[] result = task.execute().get();

But I also want a loading circle while the task is running and the ProgressDialog only works if you don't use the get() method. This is confirmed, I've done some tests. So I think the only option left here is to call the ProgressDiaglog from the MainActivity. But unluckily it doesn't work. Any solution?

Lăng Bùi
  • 167
  • 1
  • 2
  • 11

1 Answers1

1

never ever use get() with an asynctask, if you need to get something that was done in an asynctask you need to pass it to onPostExecute and use it there.

Using get() completely goes against what an asycntask is suppose to be for

tyczj
  • 71,600
  • 54
  • 194
  • 296