Friday, November 11, 2011

Re: [android-developers] Re: fragment transactions in onLoadFinished()

It's a bad user experience to show a dialog (or do any other major shift in the UI) as the result of a loader.  Here is what you are doing: setting off some operation to run in the background for an in-determinant amount of time, which upon completion may throw something in front of the user yanking them out of whatever they were doing.

My suggestion is to show the user whatever information about the loader result in-line in the same way you would show the data from it.

On Fri, Nov 11, 2011 at 5:17 PM, DH <dh1985@gmail.com> wrote:
I'm trying to display a DialogFragment and am facing the same problem.


How do you approach this?


My loader gets data from our server and I would like to display an
error dialog when for example a network problem occurs.

Thanks.
David.

On Sep 14, 11:17 pm, Dianne Hackborn <hack...@android.com> wrote:
> postDelayed is even worse.
>
> Just understand that if the activity's fragment state has already been
> saved, your code will need to correctly update it if it is later restarted
> from the state.
>
> On Wed, Sep 14, 2011 at 9:31 PM, Nikolay Elenkov
> <nikolay.elen...@gmail.com>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.Load...
> > <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 android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--
Dianne Hackborn
Android framework engineer
hackbod@android.com

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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment