On Wed, Dec 22, 2010 at 10:11 AM, Schoel <[email protected]> wrote:
> I have a function call from a large engine (which I can not change)
> which asks the user whether to save or not. Before this function call
> returns, I need an answer from the user whether to save.

Ask the save/no-save question before doing whatever causes the "large
engine" to call your callback.

> There is, as far as I know, no way to start an activity (or show a
> dialog) that synchronously returns an answer.

Correct.

> The problem is, on the second acquire, the program halts (as intended)
> without spawning the QueryUserSaveActivity (not as intended).

Correct. Not only does the other activity run on the main application
thread (which you are blocking), but startActivity() does not even
being doing anything until after current callback returns.

> Do you have any ideas what I can do to solve this?

Ask the save/no-save question before doing whatever causes the "large
engine" to call your callback. Or, always say "yes, save, please",
perhaps handling the no-save scenario yourself (e.g., make a backup of
the data file first and roll it back later).

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

-- 
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to