I’m primarily an iOS developer, but I’m creating an Android version of one of my apps, so my question will likely have an easy answer…
My app is primarily based on data that I get from SOAP requests, and I often need to update UI elements based on these requests, so I need to inform a class of when a request has ended…
In iOS this can easily be done by sending a notification with NSNotificationCenter, and I’m looking for something similar (or really anything that will accomplish the same)..
A little example:
When the app opens, the main activity starts a class(this class sends a request to the server to authenticate the user), and when that class is done parsing the gotten information, it should notify the main activity that it’s done…
Since the classes that perform the SOAP requests aren’t activities, I can’t use “StartActivityForResults/onActivityResult” – so how would I go about doing this in Android?
You can accomplish this with an AsyncTask. You can use onPostExecute to notify anything you like. Here’s a small tutorial:
http://droidapp.co.uk/?p=177
Hope it helps