title: Unable To Create CardView Fragment
body: <p>I have no idea on what is wrong with my code.</p>
  
  <p>My application is using navigation drawer. There are 4 different fragments and one of it is a cardview fragment which I have converted earlier from activity to fragment.</p>
  
  <p>The cardview fragment is being underlined red which shows error that would not able to be compiled. Kindly refer the attached pictures.</p>
  
  <p>If I were to accept the proposed solutions by the Android Studio,it will just solve the CardViewFragment and new problem would occur at the other 3 fragments.</p>
  
  <p><a href="https://i.stack.imgur.com/hQLbP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hQLbP.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/K0Ug9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K0Ug9.png" alt="enter image description here"></a></p>
  
  <p>And this is both my main activity and the cardview fragment.</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>package info.androidhive.materialdesign.activity;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentTransaction;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.Toast;
  
  import info.androidhive.materialdesign.R;
  
  public class MainActivity extends AppCompatActivity implements FragmentDrawer.FragmentDrawerListener {
  
      private static String TAG = MainActivity.class.getSimpleName();
  
      private Toolbar mToolbar;
      private FragmentDrawer drawerFragment;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          mToolbar = (Toolbar) findViewById(R.id.toolbar);
  
          setSupportActionBar(mToolbar);
          getSupportActionBar().setDisplayShowHomeEnabled(true);
  
          drawerFragment = (FragmentDrawer)
                  getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
          drawerFragment.setUp(R.id.fragment_navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout), mToolbar);
          drawerFragment.setDrawerListener(this);
  
          // display the first navigation drawer view on app launch
          displayView(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.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();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          if(id == R.id.action_search){
              Toast.makeText(getApplicationContext(), "Search action is selected!", Toast.LENGTH_SHORT).show();
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      @Override
      public void onDrawerItemSelected(View view, int position) {
          displayView(position);
      }
  
      private void displayView(int position) {
          Fragment fragment = null;
          String title = getString(R.string.app_name);
          switch (position) {
              case 0:
                  fragment = new HomeFragment();
                  title = getString(R.string.title_home);
                  break;
              case 1:
                  fragment = new FriendsFragment();
                  title = getString(R.string.title_friends);
                  break;
              case 2:
                  fragment = new MessagesFragment();
                  title = getString(R.string.title_messages);
                  break;
              case 3:
                  fragment = new CardViewFragment();
                  title = getString(R.string.title_messages);
                  break;
              default:
                  break;
          }
  
          if (fragment != null) {
              FragmentManager fragmentManager = getSupportFragmentManager();
              FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
              fragmentTransaction.replace(R.id.container_body, fragment);
              fragmentTransaction.commit();
  
              // set the toolbar title
              getSupportActionBar().setTitle(title);
          }
      }
  }
  </code></pre>
  
  <p><strong>CardViewFragment.java</strong></p>
  
  <pre><code>package info.androidhive.materialdesign.activity;
  
  import android.app.Activity;
  import android.app.Fragment;
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.widget.CardView;
  import android.support.v7.widget.GridLayoutManager;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.support.v7.widget.StaggeredGridLayoutManager;
  import android.support.v7.widget.Toolbar;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.LinearLayout;
  
  import java.util.ArrayList;
  
  import info.androidhive.materialdesign.R;
  
  
  public class CardViewFragment extends Fragment {
  
      private Toolbar toolbar;
      private RecyclerView recyclerView;
      private CardView cardView;
  
      private ArrayList&lt;FeddProperties&gt; os_versions;
  
      private RecyclerView.Adapter mAdapter;
      // private RecyclerView.LayoutManager mLayoutManager;
  
  
      private LinearLayout llLayout;
      private FragmentActivity faActivity;
      @Override
      /*protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          initContrls();
      }*/
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
          faActivity=(FragmentActivity)
                  super.getActivity();
          llLayout=(LinearLayout)
                  inflater.inflate(R.layout.activity_main, container, false);
  
          initContrls();
  
          return llLayout;
      }
  
      private void initContrls() {
  
          //toolbar = (Toolbar) findViewById(R.id.toolbar);
          //  cardView = (CardView) findViewById(R.id.cardList);
          recyclerView = (RecyclerView) llLayout.findViewById(R.id.my_recycler_view);
  
          /*if (toolbar != null) {
              setSupportActionBar(toolbar);
              getSupportActionBar().setTitle("Android Versions");
  
          }*/
  
          final String[] versions = {"Alpha", "Beta", "CupCake", "Donut",
                  "Eclair", "Froyo", "Gingerbread", "Honeycomb",
                  "Ice Cream Sandwitch", "JellyBean", "KitKat", "LollyPop"};
          final int[] icons = {R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.donut, R.drawable.eclair, R.drawable.froyo, R.drawable.gingerbread, R.drawable.honeycomb, R.drawable.icecream_sandwhich, R.drawable.jellybean, R.drawable.kitkat, R.drawable.lollipop};
  
  
          os_versions = new ArrayList&lt;FeddProperties&gt;();
  
          for (int i = 0; i &lt; versions.length; i++) {
              FeddProperties feed = new FeddProperties();
  
              feed.setTitle(versions[i]);
              feed.setThumbnail(icons[i]);
              os_versions.add(feed);
          }
  
          recyclerView.setHasFixedSize(true);
  
          // ListView
          recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  
          //Grid View
          // recyclerView.setLayoutManager(new GridLayoutManager(this,2,1,false));
  
          //StaggeredGridView
          // recyclerView.setLayoutManager(new StaggeredGridLayoutManager(2,1));
  
          // create an Object for Adapter
          mAdapter = new CardViewDataAdapter(os_versions);
  
          // set the adapter object to the Recyclerview
          recyclerView.setAdapter(mAdapter);
  
  
      }
  
  
    /*  @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.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();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }*/
  }
  </code></pre>