I am trying to create a popup window when a certain menu item is pressed. I think I have most of the code, however I am not sure what to do for showAtLocation(...) or showAsDropDown(...).
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
...
case R.id.about:
displayPopupWindow();
return true;
...
}
}
public void displayPopupWindow() {
PopupWindow popup = new PopupWindow(this);
View layout = getLayoutInflater().inflate(R.layout.popup, null);
popup.setContentView(layout);
popup.setOutsideTouchable(true);
popup.setFocusable(true);
popup.showAtLocation(??, Gravity.CENTER, 0, 0);
}
What should i put for the view for the menu or should I do this another way? I hope that makes sense and thanks for the help!