My wrote:
> Currently im developing instant messaging library. Right now i created
> a Service wich open TCP connection to the server. im thinking about
> creating a java interface which fill with a callback method that will
> be executed when event happen in the service (such as new message,
> buddy list, disconnect etc).
> user using this library can implement this interface from the activity
> and pass it back to the service so the activity can handle the event.

Off the cuff, I would recommend the service use broadcastIntent() and 
your activity receive those intents.

This provides flexibility:

-- Your service might support not only your activity, but an activity 
some other developer creates, effectively reusing your service's 
capabilities

-- Your activity might be able to support IM capabilities provided by 
multiple services, if those services commit to a consistent set of 
Intents for different events

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
The Busy Coder's Guide to Android Development -- coming in June 2008!

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