title: Trying to print a dialog through a static context on View v
body: <p>I am trying to print a dialog through a static context on View v. I am running into the error "cannot be referenced from static context." I am also not sure how to bring View v to the function. Thank you for your help.</p>
  
  <pre><code>public class QuizActivity extends Activity {
  private InterstitialAd interstitial;
  private static int SIZE = 30;
  public static int location;
  private int counter = 0;
  public static int amountCorrect = 0;
  private static float percentCorrect = 0;
  private static TextView percentText;
  
  public static int[] scores = new int[30];
  
  private int lastPosition = 0;
  
  // initialize buttons
  public static ImageButton buttons[] = new ImageButton[SIZE];
  
  // array names
  public static String[] names = {...
  };
  
  // array images
  public static int[] images = { ... };
  
  private GridView gridview;
  private static ImageAdapter imageAdapter;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      percentText = (TextView) findViewById(R.id.percentText);
  
  
      imageAdapter = new ImageAdapter(this, SIZE);
      gridview = (GridView) findViewById(R.id.gridview);
      gridview.setAdapter(imageAdapter);
  
      gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) {
              //Toast.makeText(QuizActivity.this, "" + position, Toast.LENGTH_SHORT).show();
              // PopUpActivity
  
              Intent intent = new Intent(QuizActivity.this, PopUpWindow.class);
              intent.putExtra("position", position);
              intent.putExtra("images", images);
              intent.putExtra("names", names);
  
              startActivity(intent);
  
  
  
          }
      });
  
  
  
  
  
  }
  
  
  
  public static void dimImage(int location){
      imageAdapter.dimImage(location);
      imageAdapter.notifyDataSetChanged();
  }
  public static void updateScore(){
      amountCorrect += 1;
      percentCorrect = amountCorrect*100f/SIZE;
      percentText.setText("Percent Correct: " + String.format("%.2f", percentCorrect) + "%");
      if(amountCorrect==SIZE) {
          //QuizActivity quizActivity = new QuizActivity();
          //quizActivity.printWin();
      }
  
      QuizActivity.printWin(); // wish to invoke the method from here
  }
  
  public static void printWin(){
  
  
      PopupMenu popup = new PopupMenu(QuizActivity.this, v); // here is where I am stuck
      popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());
  
      //registering popup with OnMenuItemClickListener
      popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
          public boolean onMenuItemClick(MenuItem item) {
              Toast.makeText(QuizActivity.this, "You Clicked : " + item.getTitle(), Toast.LENGTH_SHORT).show();
              return true;
          }
      });
  
      popup.show();//showing popup menu
  
  }
  
  
  }
  </code></pre>