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

Reply via email to