w.r.t andoid which of the two is better..
a) Implement runnables as inner classes and post it to a handler. Note here
variables can be directly accessed.

class AService {
     String x, y, z;  // packaged scope for efficient access.

     class B implements Runnable {
          void run() {
            x = y + z ;// do something with x,y,z
          }
      }

      onCreate() {
           mWorker.handler.postRunnable(new B());
       }
}

b) Create a MyHandler extending handler and receive messages and translate
them to the appropriate action.

class MyHandler extends Handler {
     AService a;
     public MyHandler(AService a) { }

     void action1() {
         a.x = a.y + a.z // Do something with a's inner variables.
     }

    void handleMessage(Message w) {
        action1();
    }
}

I guess people know what i mean.

regards,
harsh

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to