[android-beginners] Re: Equivalent of MS Windows PostMessage?
You can also broadcast an intent and many receivers can pick it up. Essentially its the pub/sub pattern in a service bus. On Wed, Aug 26, 2009 at 12:24 PM, roschler robert.osch...@gmail.com wrote: What is the accepted/common practice for code to post messages between objects in the Android environment? In Windows I do a lot of inter- object communication via the operating system PostMessage() facility which can post messages to Windows and even non-Windowed objects (if they have allocated a windows message queue and procedure to themselves). Is there an equivalent mechanism in Android? If there is please post the keywords I can use for searching to read about it or URLs to explanatory web pages if you have them. If this is more of a Java language or Linux kernel question then just point me in the right direction to start my investigations. Thanks, Robert -- Donn http://blog.donnfelker.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Equivalent of MS Windows PostMessage?
What is the accepted/common practice for code to post messages between objects in the Android environment? Um, there is not really an analogue of PostMessage() in Java. View has post() and postDelayed(), but those are designed to simply arrange for a Runnable to be executed on the UI thread. Can we back up a step or two and discuss what your actual objective is? PostMessage() is a means to an end -- if you can describe the end, we may be better able to give you an Android-flavored means. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Equivalent of MS Windows PostMessage?
On Aug 26, 2:37 pm, Mark Murphy mmur...@commonsware.com wrote: Can we back up a step or two and discuss what your actual objective is? PostMessage() is a means to an end -- if you can describe the end, we may be better able to give you an Android-flavored means. Hello Mark, Lots of different uses but if I had to choose one I'd say notifications, especially event notifications with the ability to pass a reference to an object to be used by the receiver of the notification along with the notice (LParam stuffing for the Windows types out there). In Windows the two main paradigms I've seen for doing that are Windows PostMessage() message passing and function callbacks. I lean towards they PostMessage() paradigm because it gets you out of the call chain that a function callback can place you in when your callback is invoked and there can be some fair degree of nuisance that comes with that condition. For example, in many windows callbacks it's a known practice to avoid doing any time consuming work in the callback or you can crash/disrupt the mechanism that is driving the callback, so you delay the processing and move it out of the callback call context by posting a notifcation to some other code you've written with a reference to a data object you created that has all the necessary information to do what you need to do. Or you can post the a notification to another thread and let it handle the time consuming task. But mostly it's straightforward event notifications. I know you know all of this, I'm just using these examples as a way to indicate my area of focus. Another example. One of the areas I know I'm going to have to read deeply about, especially since I intend to be streaming audio from a server to the handset, is how to do asynchrounous socket processing which I assume Android has some standardized notification message mechanism for.. Thanks, Robert --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---