I already have a solid way to handle if the activity is stopped.  What I'm 
struggling with is how to handle if the activity is paused due to being in 
the background.  If the Activity is paused, then calling Android 
Compatibility Package's (ACP) DialogFragment.dismiss() triggers an 
InvalidStateException.  In that same paused state, if I call 
Activity.dismissDialog(int), the framework correctly handles the dismissal 
without causing an exception.  If I were using true DialogFragments (not 
from the ACP), I could use dismissAllowingStateLoss() and I believe it 
would be fine.  However, since I'm using ACP, there is no 
dismissAllowingStateLoss().  There is more detail on the Stack Exchange 
post for this issue, which remains open:  stack 
exchange<http://stackoverflow.com/questions/10760809/how-can-you-handle-dismissing-a-dialogfragment-compatibility-lib-upon-completi/10761170#10761170>
. 

On Sunday, May 27, 2012 8:20:39 PM UTC-6, G. Blake Meike wrote:
>
> I think this problem may be more complex than you imply.  In general, the 
> Activity may be in a pretty inconsistent state (Stopped, OS thinks it is 
> dead) when your AsyncTask returns.  I can't imagine anything that you could 
> do, in that circumstance, that would work.
>
> Is there a way to attach the lifecycle of the DialogFragment to the 
> lifecycle of the Activity?
>
> G. Blake Meike
> Marakana
>
> The second edition of Programming Android is now on-line:
> http://shop.oreilly.com/product/0636920023005.do
>

-- 
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