I have an AsyncTask which downloads information from a third party website. This website is not under my control.
The problem is that sometimes I'm getting this information within 2 seconds, but sometimes it may take up to 30-40 seconds.
I know that the issue is with the website itself as I experience the same problem on my desktop in a web browser.
What I'm looking for is a way to cancel the operation if it takes longer than a certain amount of time and try again.
Here is my current code:
protected ArrayList<Card> doInBackground(Void... voids)
{
Looper.prepare();
publishProgress("Preparing");
SomeClass someClass = new SomeClass(this);
return someClass.downloadInformation();
}