Abdul Ahad Abdul Ahad - 5 months ago 16
Android Question

FragmentTransaction's setCustomAnimation() giving error

In my code, on line

transaction.setCustomAnimations()
, 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);
transaction.addToBackStack(null);
transaction.commit();
}

Answer

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

Comments