I'm working on application whose main responsibility is to contact remote server and display the data provided.
Service is Soap based. For that I use ksoap library, but let's cut to the case.
I've been "calling service" with the use of asynchronous tasks. Everything seemed to go well, but...
Service is sequential, and tends to 'lose' my requests, so I don't get proper results.
So I decided to take a synchronous approach to resolve the issue, but this way I have to provide additional loading buttons/bars etc.
The performance is terrible in this way. What is the best way to handle such case ? What kind of synchronisation can I use so there won't be any race between the requests ?
How can I make use of Android Services ? How are those better?
Thank you in advance for answers.
You can actually call the AsyncTask
in a sync way:
class MyTask extends AsyncTask<Void,Void,String>
{...}
MyTask x = new MyTask();
String result = x.execute().get();
See the docs page for AsyncTask
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With