I would like to implement the following simple pattern in an android app:
- Activity A starts activity B
- In activity B the user fills out a simple form F, then hits submit
- Activity B then starts an AsyncTask C that posts F to a url, and immediately returns to Activity A
- Back in activity A, the user continues with business as usual while C is still working. But once C is complete, the user should be notified, in particular if the result was a failure.
The problem I have is with steps 3 and 4. Since C is started by B, how can A get notified? Hmm, not sure if this is clear to anyone but me ...
Anyway, right now I am stuck with a solution where step 3 instead looks like this:
3". Activity B returns the content of the form to activity A. A then starts AsyncTask C to post the form and continues as usual.
But it just seems a bit unnecessary that A also needs to handle the form, it should just be B's responsibility. Any other ideas or solutions out there?