How to use both Android.App.Fragment and Support V4 library -


I want to use a support library to add a new El Style actionbase to my app. So I changed my activity to a ActionBarActivity now I have both getFragmentManager () and getSupportFragmentManager () .

I use getFragmentManager () to work with pieces and they are provided fine but when I get backstack ( (mTransaction.addToBackStack ("blabla" ), Then there is a problem, the backstack remains empty, so if I call mTransaction.commit () and immediately after getFragmentManager (). GetBackStackEntryCount () After 0 will return no matter how much transaction I do, as a result, in my first section of the section, without first navigation, "BACK"

Why do not I use pieces from the help library? I do not care for the app 15 and new & lt; 11 and to migrate There is a lot of code besides this, if the help library is used then I will not be able to use the objectAnimator for the transition. This is not a disaster, but I just want to improve one more addendum Do not want to be a part of an app.

So the question - is it possible to fix the stack back or support me all the related code-V4?

Edit: I was posting very fast before reading my question carefully. I have looked through source code and I highly recommend using getSupportFragmentManager () if the reason for using ActionBarActivity is that the implementation of Fragment Manager mFragments Has been shrouded in fragment activity and it is used in all activity life cycle if super classes using getFragmentManager () will be implemented. And you have to rely on fragment activity to make a super call at the right time, otherwise there may be disturbance in the life cycle. With onBackpressed () you have already searched for a case where fragmentation fails to make super call to activity.

Another solution would have to migrate but you lose some of the ActionBarActivity stuff eg. Widget-tinting and childfraggument manager.

I paste only with support implementation.

This is the basic answer and does not really apply here:

One piece transaction does not immediately add / replace your piece, so your back stack You will still be able to call getFragmentManager (). ExecutePendingTransactions () If this is really necessary.

BTW: Why do you stop using the ObjectEnimeter by using the support library?


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -