Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue when removing the supportV4 library

My app minimum version is 10 and till now i am using the support library for fragments

Now i want to add the flip animation for few fragment transition So as per the android guide we need to use the animator for that and it has support from the api level 11 which is no issue for me.

but also need to use the getFragmentManager instead getSupportFragmentManager

So i removed the support library changed my minimum version 10 to 11 errors are coming

because in my app i have FragmentTabhost and getChildFragmentManager(). FragmentTabHost only available on support library and to set FragmentManager using the getChildFragmentManager it wont allow me to do that because it requires api level 17

any help appreciated. Let me know if you need more details

Thanks in advance.

like image 810
Sandy Avatar asked Dec 01 '15 06:12

Sandy


2 Answers

use android.support.v4.fragment instead of android.app Fragment in your project

and you can use following snippet for animation while adding/replacing fragment

 getSupportFragmentManager().beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.replace(R.id.fragment, new FragmenntTwo())
.commit();

where FragemntTwo() is the fragment you are inflating.Here you can use your custome animation as well by replacing setTransition(..) with setCustomAnimations(..)

like image 118
venkatesh venkey Avatar answered Nov 15 '22 15:11

venkatesh venkey


I think coding Animation for API level 10 and below is challenging, and rather obsolete. I can give one suggestion, read web page @ NineOldAndroids from the active developer Jake Wharton. It supports Android 1.0 and up, though deprecated with new Android libraries. So one lesson is that it would be easier for you to create a new project, basically start over instead of converting code.

Even if you do use existing animation like ValueAnimator, the API level is 11 and up. You're hitting that boundary between level 10 and 11 for animation.

Good luck and keep us posted.

like image 22
The Original Android Avatar answered Nov 15 '22 16:11

The Original Android