hello there,
I have been trying to provide an answer to one of my own questions,
you can see it here:
http://groups.google.com/group/android-developers/browse_thread/thread/72f5bb4b7bf41735
so I have created a service an inner class that extends Handler.
here is the class:
private class ServiceHandler extends Handler {
Session login(final String username, final String password,
final
ActivityPendingResult result) {
post(new Runnable() {
public void run() {
long id =
Thread.currentThread().getId();
// login code here.
// creation of Session object
}
});
return mSession;
}
public void handleMessage(Message msg) {
int what = msg.what;
switch(msg.what) {
case 0:
ActivityPendingResult result =
(ActivityPendingResult) msg.obj;
result.sendResult(0, null, null);
break;
default: break;
}
}
}
the hadler.login() method gets called by the login method declared in
the Service class.
The Service.login method is called by an Activity method. What puzzles
me is that i was expecting handler.post() to spawn a new thread, and
turn the whole login process into an asynchronous one, instead the
thread id is 1 and as a result the interface on the Activity is
frozen.
what's going on here ?
take care
luka
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---