0

I am using JSOUP HTML parser to parse HTML. I have one specific site like example.com/test.html. This site consists of several divs. At first load I need to load first div. Next I need to load div specified by selected value in spinner. So my question is: Is there a way to use async task to do Jsoup.connect().get() and then use this loaded document multiple times? I programmed it inside async task but then I realized that I cant use same async task multiple time.

Any suggestions?

Thanks in forward

zmarties
  • 4,809
  • 22
  • 39
horin
  • 1,664
  • 6
  • 23
  • 52

1 Answers1

0

I'm not java or android expert, but I will try to help.

Basically - you have to learn what are callbacks/interfaces and how to use them.

You have to store downloaded HTML by declaring Document object in your Activity class and add callback that will allow AsyncTask to update that document from "outside" Activity by another thread.

It is similar to updating UI with callback.

android asynctask sending callbacks to ui

Community
  • 1
  • 1
Kamil
  • 13,363
  • 24
  • 88
  • 183