title: Why is this Error showing "Incompatible Types." "Required: android.support.v4.app.Fragment"?
body: <p>So my issue is with my Android app Fragments <code>fragment=new SlideShow();</code> is in a switch, this fuctions the NavDrawer and these people had the same issue but none of these Solutions fixed my problem <a href="https://stackoverflow.com/questions/21475581/incompatible-types-of-fragment">Solution 1</a> and <a href="https://stackoverflow.com/questions/8993348/cannot-convert-from-android-support-v4-app-fragment-to-android-app-fragment">Solution 2</a> also <a href="https://stackoverflow.com/questions/29514002/error72-42-error-incompatible-types-fragmentactivity-cannot-be-converted-t">Solution 3</a></p>
  
  <p>You may see something in the code that I haven't. I will the Error as it shows!</p>
  
  <p>I've tried adding imports and also switching implements and extends, nothing has worked and no one with the same issue as mien.</p>
  
  <p><strong>Error:</strong></p>
  
  <p><code>Error:(176, 26) error: incompatible types: SlideShow cannot be converted to Fragment</code></p>
  
  <p>and</p>
  
  <p><code>Incompatible Types.
  Required: android.support.v4.app.Fragment
  Found: com.adobe.SlideShow</code></p>
  
  <p><em>My Code Snippet:</em></p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>package com.abode;
  
  import android.content.res.Configuration;
  import android.content.res.TypedArray;
  import android.support.v4.app.ActionBarDrawerToggle;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBarActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.ListView;
  import java.util.ArrayList;
  
  /**
  * Created by Ryan Tarson on 3/23/2015.
  */
  public class MainActivity extends ActionBarActivity
  {
  
      private DrawerLayout mDrawerLayout;
      private ListView mDrawerList;
      private ActionBarDrawerToggle mDrawerToggle;
  
      // nav drawer title
      private CharSequence mDrawerTitle;
      // used to store app title
      private CharSequence mTitle;
      // slide menu items
      private String[] navMenuTitles;
      private TypedArray navMenuIcons;
  
      //old code
      private ArrayList&lt;NavDrawerItem&gt; navDrawerItems;
  
      private NavDrawerListAdapter adapter;
      LayoutInflater inflater;
  
      //experiment code
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.drawer_main);
  
  
  
          mTitle = mDrawerTitle = getTitle();
  
  
          navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
  
  
          navMenuIcons = getResources().obtainTypedArray(R.array.nav_drawer_icons);
  
          mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
          mDrawerList = (ListView) findViewById(R.id.left_drawer);
          navDrawerItems = new ArrayList&lt;NavDrawerItem&gt;();
  
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1)));
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons.getResourceId(1, -1)));
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[2], navMenuIcons.getResourceId(2, -1)));
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[3], navMenuIcons.getResourceId(3, -1)));
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1)));
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1)));
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[6], navMenuIcons.getResourceId(6, -1)));
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[7], navMenuIcons.getResourceId(7, -1)));
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[8], navMenuIcons.getResourceId(8, -1)));
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[9], navMenuIcons.getResourceId(9, -1)));
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[10], navMenuIcons.getResourceId(10, -1)));
  
          navMenuIcons.recycle();
  
          mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
  
          adapter = new NavDrawerListAdapter(getApplicationContext(),navDrawerItems);
  
          mDrawerList.setAdapter(adapter);
          // enabling action bar app icon and behaving it as toggle button
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          getSupportActionBar().setDisplayShowHomeEnabled(true);
          getSupportActionBar().setHomeButtonEnabled(true);
          getSupportActionBar().setLogo(R.drawable.logo);
         // getSupportActionBar().setDisplayUseLogoEnabled(true);
  
          mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.side_bar, R.string.app_name, R.string.app_name) {
              public void onDrawerClosed(View view) {
                  getSupportActionBar().setTitle(mTitle);
                  // calling onPrepareOptionsMenu() to show action bar icons
                  invalidateOptionsMenu();
  
              }
  
              public void onDrawerOpened(View drawerView) {
                  getSupportActionBar().setTitle(mDrawerTitle);
                  // calling onPrepareOptionsMenu() to hide action bar icons
                  invalidateOptionsMenu();
              }
          };
          mDrawerLayout.setDrawerListener(mDrawerToggle);
  
          if (savedInstanceState == null) {
              // on first time display view for first nav item
              selectItem(0);
          }
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
         /* int id = item.getItemId();
          if (id == R.id.action_settings)
          {
              return true;
          }*/
          switch (item.getItemId()) {
  
              case android.R.id.home: {
                  if (mDrawerLayout.isDrawerOpen(mDrawerList)) {
                      mDrawerLayout.closeDrawer(mDrawerList);
                  } else {
                      mDrawerLayout.openDrawer(mDrawerList);
                  }
                  break;
              }
  
              case R.id.action_settings:
  
          }
          return super.onOptionsItemSelected(item);
      }
  
      private class DrawerItemClickListener implements ListView.OnItemClickListener {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position,
                                  long id) {
              selectItem(position);
          }
      }
  
      @Override
      protected void onPostCreate(Bundle savedInstanceState) {
          super.onPostCreate(savedInstanceState);
          // Sync the toggle state after onRestoreInstanceState has occurred.
          mDrawerToggle.syncState();
      }
  
      @Override
      public void onConfigurationChanged(Configuration newConfig) {
          super.onConfigurationChanged(newConfig);
          // Pass any configuration change to the drawer toggles
          mDrawerToggle.onConfigurationChanged(newConfig);
      }
      private void selectItem(int position)
      {
  
          Fragment fragment = null;
          switch (position)
          {
              case 0:
                  fragment=new SlideShow();
  
  
                  break;
  
              case 1:
                  fragment=new Beauty();
  
  
                  break;
  
              default:
                  break;
          }
          if (fragment != null) {
              FragmentManager fragmentManager = getSupportFragmentManager();
              fragmentManager.beginTransaction()
                      .replace(R.id.content, fragment).commit();
  
              // update selected item and title, then close the drawer
              mDrawerList.setItemChecked(position, true);
              mDrawerList.setSelection(position);
  //            setTitle(navMenuTitles[position]);
              mDrawerLayout.closeDrawer(mDrawerList);
          } else {
              // error in creating fragment
              Log.e("MainActivity", "Error in creating fragment/Assigned designated page.");
          }
          // mDrawerLayout.closeDrawer(mDrawerList);
      }
      @Override
      public void setTitle(CharSequence title) {
          mTitle = title;
          getSupportActionBar().setTitle(mTitle);
      }
  
  }
  </code></pre>
  
  <p>Here is were the "Home" Page is this the <code>case 0;</code> is the Home tab!
  <strong>SlideShow.java</strong> </p>
  
  <pre><code>package com.abode;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.Fragment;
  import android.app.Activity;
  import android.content.Context;
  import android.view.Window;
  import android.view.animation.AnimationUtils;
  import android.widget.AdapterView;
  import android.widget.BaseAdapter;
  import android.widget.Gallery;
  import android.widget.Gallery.LayoutParams;
  import android.widget.ImageSwitcher;
  import android.widget.ImageView;
  import android.widget.ViewSwitcher;
  /**
   * Created by Ryan on 5/5/2015.
   */
  public class SlideShow extends Activity implements
          AdapterView.OnItemSelectedListener, ViewSwitcher.ViewFactory  {
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          requestWindowFeature(Window.FEATURE_NO_TITLE);
  
          setContentView(R.layout.homeslideshow);
  
          mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
          mSwitcher.setFactory(this);
          mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
                  android.R.anim.fade_in));
          mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
                  android.R.anim.fade_out));
  
          Gallery g = (Gallery) findViewById(R.id.gallery);
          g.setAdapter(new ImageAdapter(this));
          g.setOnItemSelectedListener(this);
      }
  
      public void onItemSelected(AdapterView&lt;?&gt; parent, View v, int position, long id) {
          mSwitcher.setImageResource(mImageIds[position]);
      }
  
      public void onNothingSelected(AdapterView&lt;?&gt; parent) {
      }
  
      public View makeView() {
          ImageView i = new ImageView(this);
          i.setBackgroundColor(0xFF000000);
          i.setScaleType(ImageView.ScaleType.FIT_CENTER);
          i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.MATCH_PARENT,
                  LayoutParams.MATCH_PARENT));
          return i;
      }
  
      private ImageSwitcher mSwitcher;
  
      public class ImageAdapter extends BaseAdapter {
          public ImageAdapter(Context c) {
              mContext = c;
          }
  
          public int getCount() {
              return mThumbIds.length;
          }
  
          public Object getItem(int position) {
              return position;
          }
  
          public long getItemId(int position) {
              return position;
          }
  
          public View getView(int position, View convertView, ViewGroup parent) {
              ImageView i = new ImageView(mContext);
  
              i.setImageResource(mThumbIds[position]);
              i.setAdjustViewBounds(true);
              i.setLayoutParams(new Gallery.LayoutParams(
                      LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
              i.setBackgroundResource(R.drawable.onebig);
              return i;
          }
  
          private Context mContext;
  
      }
  
      private Integer[] mThumbIds = {
          R.drawable.test, R.drawable.onebig,
      };
  
      private Integer[] mImageIds = {
          R.drawable.test, R.drawable.onebig,
      };
  
  }
  </code></pre>