you need to create handler = new android.os.Handler() attached to the
current thread and use this function called by your second thread.
handler.post(new Runnable() {
public void run() {
....
current Activity = current thread => handler = new
android.os.Handler()
create new thread (with handler reference)
post something under this handler to your second thread
On 27 août, 07:04, april <[EMAIL PROTECTED]> wrote:
> I am doing a game, which needs to update server player's status. In my
> code , I first put those information into database. Then I used a
> service to read the information from DB and send to server.
>
> Following are the document for sevice:
> Note that services, like other application objects, run in the main
> thread of their hosting process. This means that, if your service is
> going to do any CPU intensive (such as MP3 playback) or blocking (such
> as networking) operations, it should spawn its own thread in which to
> do that work. More information on this can be found in the Threading
> section of the Application Model overview.
>
> Should I using thread in the service to send data to server?
>
> What is the best way to do that?
>
> Thanks!
>
> April
--~--~---------~--~----~------------~-------~--~----~
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 Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---