Thanks! I will try that.

On Jan 7, 9:55 pm, A R <[email protected]> wrote:
> HiCindy,
>
>  You can implement the same observer pattern. Create a delegate
> interface, pass the reference to the thread and once work is done let
> the thread do the call backs. Skeleton below might help (note code
> below will not compile)
>
> interface callback {
>  workSuccess(); //pass params based on your logic
>  workFailure();
>
> }
>
> MyUi implements callback {
>  updateUI() {
>    MyBackend.getMails(this); //this start a new thread or let getMails
> start a new thread
>  }
>  function workSuccess() {
>    //make sure if you are updating UI it has to be done in
> handler.post
>  }
>  function workFailure() {
>  }
>
> }
>
> MyBackend {
>  function getMails(callback delegate) {
>    //get mails
>    if (success) {
>      delegate.workSuccess();
>    } else {
>      delegate.workFailure();
>    }
>  }
>
> }
>
> HTH
>
> On Jan 7, 10:47 am,cindy<[email protected]> wrote:
>
> > Hi All,
>
> > It is a common question for UI.
>
> >  If user needs to send a request to server to get information, it
> > always have delay time. In regular java code, we can first generate
> > default UI, display it. Then send request to server in a thread. After
> > response is back,  update the UI.
>
> > If the application is to retrieve emails, how can I implement the
> > similar functionality in android?
> > Where can I find sample code?
>
> > Thanks!
>
> >Cindy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to