title: Cannot be referenced from static context Android
body: <p>I'm a beginner on Android, i'm creating a movie application where the user can browse the movies and search for top rated or most popular ones.
  i'm using DetailsFragment to display movie details, also i'm using an expandable list view to display movie's trailers and reviews</p>
  
  <p>my problem is that i get an error on this line 
  listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);</p>
  
  <p>that says: this cannot be referenced from static context and i can't solve it by using getActivity() or DetailsFragment.this</p>
  
  <p>Sorry if I'm being extremely incompetent but I searched and I couldn't understand how to fix it. Thanks.</p>
  
  <p>here is DetailsFragment.java</p>
  
  <pre><code>package com.example.android.movies;
  
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ExpandableListAdapter;
  import android.widget.ExpandableListView;
  import android.widget.ImageView;
  import android.widget.TextView;
  import android.widget.ToggleButton;
  
  import com.squareup.picasso.Picasso;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  
  import static com.example.android.movies.R.id.favoriteButton;
  import static com.example.android.movies.R.id.iv_poster;
  
  
  /**
   * A placeholder fragment containing a simple view.
   */
  public class DetailsFragment extends Fragment{
  
  
      static Long id;
      String title, overview, poster, date;
      String vote;
      ImageView posterIV;
      TextView titleTV, dateTV, overviewTV, voteTV;
      static Context mContext;
  
      static ExpandableListAdapter listAdapter;
      static ExpandableListView expListView;
      static List&lt;String&gt; listDataHeader;
      static HashMap&lt;String, List&lt;Trailers&gt;&gt; listDataChild;
  
      static ArrayList&lt;Trailers&gt; arrTrailers;
      static ArrayList&lt;Trailers&gt; arrReviews;
  
      ToggleButton favorite;
      private MoviesDB db;
  
      Trailers t;
  
  
      public static DetailsFragment newInstance() {
          return new DetailsFragment();
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View rootView = inflater.inflate(R.layout.fragment_details, container, false);
  
          // get the listview
          expListView = (ExpandableListView) rootView.findViewById(R.id.lvExp);
  
          // receiving intent
  
          Intent gIntent = getActivity().getIntent();
          Movies movie = null;
          if (gIntent != null &amp;&amp; gIntent.hasExtra("movie")) {
              movie = gIntent.getParcelableExtra("movie");
  
  
              id = movie.getMposter_id();
  
              title = movie.getMtitle();
              titleTV = (TextView) rootView.findViewById(R.id.tv_title);
              titleTV.setText(title);
  
              date=movie.getMdate();
              dateTV = (TextView) rootView.findViewById(R.id.tv_date);
              dateTV.setText(date);
  
              vote=String.valueOf(movie.getMvote());
              voteTV= (TextView) rootView.findViewById(R.id.tv_vote);
              voteTV.setText(vote);
  
  
              overview=movie.getMoverview();
              overviewTV = (TextView) rootView.findViewById(R.id.tv_overview);
              overviewTV.setText(overview);
  
              poster = movie.getMposter_path();
              posterIV = (ImageView) rootView.findViewById(iv_poster);
              Picasso.with(getActivity())
                      .load("http://image.tmdb.org/t/p/w185".concat(poster)).into(posterIV);
  
              favorite= (ToggleButton) rootView.findViewById(favoriteButton);
  
          }
          favorite.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  db.insert(id,title,poster,date, Double.parseDouble(vote),overview,t.getContent1());
  
              }
          });
  
          return rootView;
      }
  
      private static void settingAdapter() {
          // preparing list data
          prepareListData();
  
          listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
  
          // setting list adapter
          expListView.setAdapter(listAdapter);
      }
  
      /*
       * Preparing the list data
       */
      private static void prepareListData() {
          listDataHeader = new ArrayList&lt;String&gt;();
          listDataChild = new HashMap&lt;String, List&lt;Trailers&gt;&gt;();
  
  
          // Adding child data
          listDataHeader.add("Reviews");
          listDataHeader.add("Trailers");
  
          listDataChild.put(listDataHeader.get(0), arrReviews); // Header, Child data
          listDataChild.put(listDataHeader.get(1), arrTrailers);
      }
  
      @Override
      public void onActivityCreated(@Nullable Bundle savedInstanceState) {
          super.onActivityCreated(savedInstanceState);
  
          mContext=getActivity();
  
          new TrailersFetcher(getActivity(), id).execute();
      }
  
      public static void updateTrailers(ArrayList&lt;Trailers&gt; trailers){
  
          arrTrailers = new ArrayList&lt;&gt;();
          for (int i = 0; i &lt;trailers.size() ; i++) {
              arrTrailers.add(trailers.get(i));
  
          }
          new ReviewsFetcher(mContext, id).execute();
      }
  
      public static void updateReviews(ArrayList&lt;Trailers&gt; reviews){
          arrReviews = new ArrayList&lt;&gt;();
  
          for (int i = 0; i &lt;reviews.size() ; i++) {
              arrReviews.add(reviews.get(i));
  
          }
  
          settingAdapter();
      }
  }
  </code></pre>