It's already been mentioned: http://developer.android.com/reference/android/app/FragmentTransaction.html#commitAllowingStateLoss()
Which is explicitly referenced from the commit documentation: http://developer.android.com/reference/android/app/FragmentTransaction.html#commit() You just need to be explicit that this is what you want to have happen. On Mon, Feb 27, 2012 at 7:58 AM, Cybrosys <[email protected]> wrote: > Well this is just ridiculous. > > I have a login screen and when the user presses "Log in" I want to display > a ProgressDialogFragment saying "Logging in. Please wait...". I have a > AsyncTaskLoader that does the authentication against a Web Service and > returns the result. Once I have the result I want to remove the > ProgressDialogFragment... but according to you that's impossible because I > am not allowed to talk to fragments in the onLoadFinished callback? > > My previous solution was using the AsyncTask<T> and ProgressDialog class > but they are "deprecated" and I was told to use Fragments and Loaders > instead since they have been backported. > > I would really like to know what you consider to be "best-practice" when > it comes to doing async work and notifying the user? > > On Thursday, September 15, 2011 6:31:35 AM UTC+2, Nikolay Elenkov wrote: >> >> I have a simple activity with a list fragment on the left and a details >> fragment on the right. Tapping a list item kicks off a loader which >> gets some data over HTTP and delivers it in onLoadFinished(). >> That works fine, but I'd like to change the detail fragment at this >> point. Calling FragmentTransaction.commit() results in an >> IllegalStateException, as explained in the docs [1]. >> FragmentTransaction.**commitAllowingStateLoss() seems to >> work, but feels wrong. What would be the right/preferred way >> to do this? postDealyed()? >> >> >> 1. http://developer.android.com/**reference/android/app/** >> LoaderManager.LoaderCallbacks.**html#onLoadFinished(android.** >> content.Loader<http://developer.android.com/reference/android/app/LoaderManager.LoaderCallbacks.html#onLoadFinished(android.content.Loader> >> <D>, >> D) >> > -- > 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 > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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

