title: Error incompatible types: android.app.FragmentManager cannot be converted to android.support.v4.app.FragmentManager
body: <p>Error <code>Error incompatible types: android.app.FragmentManager cannot be converted to android.support.v4.app.FragmentManager</code> is drving me nuts. </p>
  
  <p>In my app, I have 3 navigation drawer item, <code>timesheet</code>,<code>claim</code> and <code>view</code>, created in MainActivity. Now I wanted to add two <code>tabs</code> with <code>swipe view</code> in <code>view</code> item. </p>
  
  <p><strong>MainActivity</strong>  // for navigation drawer</p>
  
  <pre><code>   import android.app.Fragment;
     import android.app.FragmentManager;
     private void selectItem(int position) {
  
              Fragment fragment = null;
  
              switch (position) {
                  case 0:
                      fragment=new TimeSheet();
                      break;
                  case 1:
  
                      fragment=new Claims1();
                      break;
  
                  case 2:
                      fragment=new Viewview();
                      break;
  
                  default:
                      break;
              }
  </code></pre>
  
  <p><strong>TabsFragmentPagerAdapter.java</strong></p>
  
  <pre><code>import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentPagerAdapter;
  
  public class TabsFragmentPagerAdapter extends FragmentPagerAdapter {
  
      public TabsFragmentPagerAdapter(FragmentManager fm) {
          super(fm);
          // TODO Auto-generated constructor stub
      }
  
      @Override
      public Fragment getItem(int index) {
          // TODO Auto-generated method stub
  
          switch(index) {
              case 0:
                  return new UpdatePage2();
              case 1:
                  return new Receipt();
  
          }
          return null;
      }
  
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return 2;
      }
  
  }
  </code></pre>
  
  <p><strong>ViewView.java</strong></p>
  
  <pre><code>import android.app.Fragment;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.database.sqlite.SQLiteDatabase;
  import android.os.Bundle;
  import android.app.FragmentTransaction;
  import android.support.v4.view.ViewPager;
  import android.app.ActionBar;
  import android.support.v4.widget.SimpleCursorAdapter;
  import android.support.v7.app.AlertDialog;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.ListView;
  
  import com.example.project.project.database.MyDatabaseHelper;
  
  public class ViewView extends Fragment implements ActionBar.TabListener {
  
      InfoAPI sqlcon;
      private SimpleCursorAdapter dataAdapter;
      private SQLiteDatabase database;
      private MyDatabaseHelper dbHelper;
      private ListView listView;
      private ViewPager viewPager;
      private TabsFragmentPagerAdapter mAdapter;
      private ActionBar actionBar;
      private String[] tabs = {"Information", "receipt"};
  
  
  
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          View View1 = inflater.inflate(R.layout.viewview1, container, false);
          listView = (ListView) View1.findViewById(R.id.listView1);
          dbHelper = new MyDatabaseHelper(getActivity());
          sqlcon = new InfoAPI(getActivity());
          viewPager = (ViewPager) View1.findViewById(R.id.pager);
          mAdapter = new TabsFragmentPagerAdapter(getActivity().getFragmentManager()); //here the error
          viewPager.setAdapter(mAdapter);
          actionBar = getActivity().getActionBar();
          actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
          for (int i = 0; i &lt; 2; i++) {
              actionBar.addTab(actionBar.newTab().setText(tabs[i]).setTabListener(this));
          }
          viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
  
              @Override
              public void onPageSelected(int arg) {
                  // TODO Auto-generated method stub
                  actionBar.setSelectedNavigationItem(arg);
              }
  
              @Override
              public void onPageScrolled(int arg0, float arg1, int arg2) {
                  // TODO Auto-generated method stub
  
              }
  
              @Override
              public void onPageScrollStateChanged(int arg0) {
                  // TODO Auto-generated method stub
  
              }
          });
  
          BuildList();
          return View1;
      }
  </code></pre>
  
  <p>Problem :</p>
  
  <blockquote>
    <p>Error:(49, 81) error: incompatible types: android.app.FragmentManager
    cannot be converted to android.support.v4.app.FragmentManager</p>
  </blockquote>
  
  <p>If changed <code>import android.support.v4.app.FragmentManager;</code> in <code>TabsFragmentPagerAdapter</code> to <code>import android.app.FragmentManager;</code>, the first issue solve but get this <code>Error:(12, 15) error: incompatible types: android.app.FragmentManager cannot be converted to android.support.v4.app.FragmentManager</code>...I have no idea how to fix ..</p>
  
  <p>Edited</p>
  
  <p><strong>MainActivity</strong></p>
  
  <pre><code>import android.app.Fragment;
  import android.support.v4.app.FragmentManager;
    case 2:
                      fragment=new ViewView();
                      break;
  
                  default:
                      break;
              }
  
              if (fragment != null) {
                  FragmentManager fragmentManager = getFragmentManager();
                  fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
  
                  mDrawerList.setItemChecked(position, true);
                  mDrawerList.setSelection(position);
                  setTitle(mNavigationDrawerItemTitles[position]);
                  mDrawerLayout.closeDrawer(mDrawerList);
  
              } else {
                  Log.e("MainActivity", "Error in creating fragment");
              }
          }
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <blockquote>
    <p>Error:(148, 30) error: incompatible types: ViewView cannot be
    converted to Fragment Error:(156, 69) error: incompatible types:
    android.app.FragmentManager cannot be converted to
    android.support.v4.app.FragmentManager Error:(157, 80) error:
    incompatible types: android.app.Fragment cannot be converted to
    android.support.v4.app.Fragment</p>
  </blockquote>