Abdul Ahad Abdul Ahad - 1 year ago 74
Android Question

FragmentTransaction's setCustomAnimation() giving error

In my code, on line

, the IDE is showing:

Expected Resource of Type Animator

Here is my code:

import android.app.Fragment;
import android.app.FragmentTransaction;

private void loadPasswordFragment() {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
Fragment mFragment = new ForgotWithPasswordFrag();
transaction.setCustomAnimations( R.anim.fade_out, R.anim.fade_in);
transaction.replace(R.id.container, mFragment);

Answer Source

I solved it by using android.R.animator.fade_in instead of R.anim.fade_in.