title: Trying to implement Card Flip animation to fragments (Android)
body: <p>I am trying to implement card flip animation to my fragments, I am following the tutorial at the Developer website <a href="http://developer.android.com/training/animation/cardflip.html" rel="nofollow">http://developer.android.com/training/animation/cardflip.html</a></p>
  
  <p>However I am getting a weird error, I downloaded the sample app from the Developer website, which to my amazement works fine but when I replace the code in my particular activity it gives me an error: </p>
  
  <p><strong>The method setCustomAnimations(int, int) in the type FragmentTransaction is not applicable for the arguments (int, int, int, int)</strong></p>
  
  <p>Here is the problem code: </p>
  
  <pre><code>private View.OnClickListener on = new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              FragmentManager fragmentManager = getFragmentManager();  
              FragmentTransaction fragmentTransaction = fragmentManager  
                      .beginTransaction();
  
              fragmentTransaction.setCustomAnimations(
                              R.animator.card_flip_right_in, R.animator.card_flip_right_out,
                              R.animator.card_flip_left_in, R.animator.card_flip_left_out);
              //Fragment1_2 fragment1_2 = new Fragment1_2();  
              fragmentTransaction.replace(R.id.realtabcontent, new Fragment1_2()); 
              fragmentTransaction.addToBackStack(null);
              fragmentTransaction.commit();  
  
          }
      };
  </code></pre>
  
  <p><strong>Edit</strong>
  If I comment the first two or the last two arguments to setCustomAnimation, everything just works fine, however I dont get the animation back press which I know is an implementation issue. Below is the complete code of this fragment's class file:</p>
  
  <pre><code>public class FragmentTab1 extends Fragment {
      MenuItem mMenuItem;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
  
  
          View rootView = inflater.inflate(R.layout.fragmenttab1, container, false);
          ActionBar actionBar = getActivity().getActionBar();
          //  actionBar.setSubtitle("mytest");
          actionBar.setTitle("Reminders"); 
          setHasOptionsMenu(true);
  
  
  
  
          Button b = (Button)rootView.findViewById(R.id.button1); 
          b.setOnClickListener(on);
          b.setText("Check");
          return rootView;
      }
      private View.OnClickListener on = new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              FragmentManager fragmentManager = getFragmentManager();  
              FragmentTransaction fragmentTransaction = fragmentManager  
                      .beginTransaction();
  
              fragmentTransaction.setCustomAnimations(
                            //  R.animator.card_flip_right_in, R.animator.card_flip_right_out);
                              R.animator.card_flip_left_in, R.animator.card_flip_left_out);
              //Fragment1_2 fragment1_2 = new Fragment1_2();  
              fragmentTransaction.replace(R.id.realtabcontent, new Fragment1_2()); 
              fragmentTransaction.addToBackStack(null);
              fragmentTransaction.commit();  
  
          }
      };
  
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater =getActivity().getMenuInflater();
          inflater.inflate(R.menu.main, menu);
  
          return true;
      }
  
      public boolean onOptionsItemSelected(MenuItem item) {
  
          mMenuItem = item; 
          FragmentManager fragmentManager = getFragmentManager();  
          FragmentTransaction fragmentTransaction = fragmentManager  
                  .beginTransaction();  
          switch (item.getItemId()) {
          case R.id.info:
              FragmentContact fragmentcontact = new FragmentContact(); 
              fragmentTransaction.replace(R.id.realtabcontent, fragmentcontact, "Fragment1_2");  
              mMenuItem.setEnabled(false); 
              fragmentTransaction.addToBackStack(null);
              fragmentTransaction.commit();  
              break;
  
          default:
  
              break; 
          }
  
          return true;
      } 
  
      @Override
      public void onStart(){
          ActionBar actionBar = getActivity().getActionBar(); 
          actionBar.setTitle("Reminders"); 
          FragmentManager Fm = getFragmentManager();
          Fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); 
          super.onStart(); 
      }
      @Override
      public void onResume(){
          ActionBar actionBar = getActivity().getActionBar(); 
          actionBar.setTitle("Reminders"); 
          FragmentManager Fm = getFragmentManager();
          Fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); 
          super.onResume(); 
      }
  }
  </code></pre>
  
  <p>Any hints where I am going wrong would be regarded in great esteem! </p>