• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Throwing an event in an Application, handling it in an Activity


May 17, 2010
I'm building my first application which consists of a number of Activities and a centralised Application which holds larger objects and variables which are accessed throughout the application.

I am looking for a way to 'throw' events at the Application level, and handle them at the Activity level.

Specifically, I have an object held in Application, which has a Date member variable. When the date/time is met, I need an event to be thrown. The user could be viewing any of the screens at this time, and the event will be handled differently depending on which screen they are on.

I have tried solving this using Handlers and Broadcasts, but have been unsuccessful so far. All examples have the 'sender' and the 'receiver' in the same class, I run into problems when trying to separate them.

If anyone can give any advice on what I should be using to achieve this, it would be much appreciated. In other environments, I would do this by having the Application cause an Event, and Handling this event in each of the activities. Is something like this possible?

Thanks in advance, I hope that is clear enough.


We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.