Re: [android-developers] Re: Getting access to a UI Context safely from anywhere

2012-02-16 Thread Mark Murphy
On Thu, Feb 16, 2012 at 10:52 AM, Weston Weems wrote: > Thanks for the tip. If I understand the source right, the idea is that > when those events occur, you just broadcast it... say like {some > network error message}... and have my base activity listen for those > broadcasts? Yup, with the acti

[android-developers] Re: Getting access to a UI Context safely from anywhere

2012-02-16 Thread Weston Weems
Kristopher, This is a completely custom build of the os for very specific hardware. Our software doesn't really have the concept of notification bar. Thats not to say the facilities dont exist, but a user of our hardware doesn't have access to notifications generally. Believe me in out of box AOS

[android-developers] Re: Getting access to a UI Context safely from anywhere

2012-02-16 Thread Weston Weems
Mark, Thanks for the tip. If I understand the source right, the idea is that when those events occur, you just broadcast it... say like {some network error message}... and have my base activity listen for those broadcasts? Then because they are implemented on an activity, I should theoretically b

Re: [android-developers] Re: Getting access to a UI Context safely from anywhere

2012-02-16 Thread TreKing
On Thu, Feb 16, 2012 at 12:28 AM, Weston Weems wrote: > I also tried to have in my base callback a context we pass through... > could be activity or app context and thats fine... and say I want to > spawn dialog if context is a subclass of Activity... seems like that > works decent... but seems l

Re: [android-developers] Re: Getting access to a UI Context safely from anywhere

2012-02-16 Thread Mark Murphy
A variation on that theme is to use an ordered broadcast, so it can be picked up by a foreground activity (if one exists) or raise a Notification (if not): http://commonsware.com/blog/2010/08/11/activity-notification-ordered-broadcast.html https://github.com/commonsguy/cw-advandroid/tree/master/Br

Re: [android-developers] Re: Getting access to a UI Context safely from anywhere

2012-02-15 Thread Kristopher Micinski
It seems like what you should really be doing is using a system notification anyway, you don't want to randomly pop up a dialog box (actually, you can probably pop up a toast in your case, which you can do from the application context..), but a system bar notification probably makes the most sense.

[android-developers] Re: Getting access to a UI Context safely from anywhere

2012-02-15 Thread Weston Weems
Treking Basically this is what I've done... say I have MyAppActivity which has stuff that automatically registers itself into application... events come in, application gets last accessed and I use that to start dialogs etc. Seemed like there were cases where it was throwing exceptions about null