I have an AsyncTask wich I call with
String a = ws.get();
So that process waits until asynctask is done.
But what I want is to wait for max 10 seconds, if asynch is not finished in that time I would like to go pass it and let it to its thing in the background.
So the flow would be:
- call async
- wait until its done but max 10s
- other code
Any idea how I would accomplish this?
EDIT:
To furder explain what I am doing. I am printing some data on a mini bluetooth printer. When I press print I run a async task that prepares data to print. And this async task calls another async task to fetch some data from internet. But I need that data before I print so I use ws.get(). BUT if internet is slow and the task needs too much time (5-10seconds), I would like to bypass the ws.get() and print anyway BUT the async task still need to run since the data I get from internet will still go to my database it just will not get printed.