Ok,

I've encountered several cases where I'd like to instantiate classes
that exist as a child of my application subclass, events fire say like
a communications error, and we'd like to be able to popup a sort of
general communication error anywhere in my app.

Another example is say where applicable have a progress dialog for
network transport items etc... I'd *LIKE* to be able to just get a
reference to the context, in before start, popup dialog, after finish
hide dialog.

The way I have things setup, we have a base callback for network
transport that has started, finished, error etc. Currently we create
an anonymous subclass and fire off the request. This works great, but
requires us to write implementation handling each and every sort of
error etc. (I'd like to have it handled in base class).

My callback does have a context constructor parameter, but every
context doesnt appear to be a UI Context (from which i can pop a
dialog etc), nor does it guarantee that when we try to go to pop it
up, we dont get a window token error.

For a while I was trying to have each activity onresume set a
"CurrentUIContext" in application, but this seems to be somewhat
problematic because it can potentially lead to leaking an activity,
and because if not maintained properly, context may be set, but trying
to pop a dialog with it ends up wit the window token error.


I dont want to try and pop anything from background if my app isnt
visible or anything, but it doesnt even seem there is a decent way to
test to see if context is
1) a valid ui context from which I can pop dialogs, show dialog
fragments etc
2) know if the reference to the instance of the activity or whatever
actually has ties enough to spawn a dialog etc.


I can see a very small excuse for this strange functionality, people
trying to do malicious stuff, or causing unexpected ui behaviour, but
other than some very specific cases, my network communications will
always be the result of a button click.

Any advice here would be greatly appreciated!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to