title: Cannot resolve getActivity() in recyclerView.adapter
body: <p>Got stuck little bit. I tried change getActivity to 'c' (context), but then getSupportFragmentManager gets the same error. Read different topics on this, but couldn't find a solution. Checked libraries and tried to change them but nothing. Would appreciate some help!</p>
  
  <pre><code> import android.app.Activity;
   import android.content.Context;
   import android.support.v4.app.FragmentManager;
   import android.support.v4.app.FragmentTransaction;
   import android.support.v4.app.DialogFragment;
   import android.support.v4.app.Fragment;
   import android.support.v7.widget.RecyclerView;
   import android.view.LayoutInflater;
   import android.view.View;
   import android.view.ViewGroup;
   import android.widget.Toast;
  
   import com.bumptech.glide.Glide;
   import com.bumptech.glide.load.engine.DiskCacheStrategy;
   import com.example.mrti.menu.Fragments.MealsListFragment;
   import com.example.mrti.menu.R;
   import java.util.ArrayList;
  
  
   public class CategoryAdapter extends RecyclerView.Adapter&lt;ViewHolder&gt; {
  
  Context c;
  ArrayList&lt;Category&gt; Categories;
  
  public CategoryAdapter(Context c, ArrayList&lt;Category&gt; Categories) {
      this.c = c;
      this.Categories = Categories;
  }
  // INITIALIZE HOLDER
  @Override
  public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
  
      View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.rec_item, null);
      ViewHolder holder = new ViewHolder(v);
      return holder;
  }
  @Override
  public void onBindViewHolder(ViewHolder holder, final int position) {
  
      // BIND DATA TO VIEWS
  
      holder.mNameTextView.setText(Categories.get(position).getName());
  
      // LOAD IMAGES FROM WEB AND CACHE THEM
  
      Glide.with(c)
              .load(Categories.get(position).getImage())
              .diskCacheStrategy(DiskCacheStrategy.ALL) // Saves the media item after all transformations to cache and
                                                       // Saves just the original data to cache.
              .placeholder(R.mipmap.ic_launcher)
              .into(holder.img);
  
      // LISTENER
  
      holder.setItemClickListener(new itemClickListener() {
          @Override
          public void onItemClick(View v, int pos) {
              Toast.makeText(c, Categories.get(pos).getName(), Toast.LENGTH_SHORT ).show();
  
              MealsListFragment fragment = new MealsListFragment();
              FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
              FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
              fragmentTransaction.replace(R.id.root_layout, fragment);
              fragmentTransaction.addToBackStack(null);
              fragmentTransaction.commit();
  
  
          }
      });
     }
  </code></pre>