I have a Main
class that runs a receberSolicitantes()
method with a task in background . While it runs, it updates a progressBar
.
Everything is working perfectly with the method as follows:
public void receberSolicitantes() {
JsonReceber receber = new JsonReceber(this, "solicitantes", this.progressBar);
receber.execute();
}
But when I put the receber.get()
line (as shown below) to fetch the return, the onProgressUpdate
(asynchronous class JsonReceber
) method only runs at the end of doInBackground
, and thus progressBar
does not work.
Added receber.get()
:
public void receberSolicitantes() {
JsonReceber receber = new JsonReceber(this, "solicitantes", this.pb);
receber.execute();
try {
receber.get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
How do I search for background rendering?
It would be the same way I do with progressBar
leading to the call
JsonReceber receber = new JsonReceber(this, "solicitantes", this.progressBar)
?