从 Actionbar Menuitem 调用 modifiedPopupWindow class:这甚至可能吗?

Calling modifiedPopupWindow class from Actionbar Menuitem: Is this even possible?

我有一个 PopupWindow,我想从操作栏中的菜单项调用它。 PopupWindow class 是,

public class speciesPopupWindow {
Context ctx;
Button btnDismiss, ...;

public speciesPopupWindow(Context ctx){
    this.ctx = ctx;
}
public void init(View v){ 
LayoutInflater inflater = (LayoutInflater) ctx.getSystemService...
View popUpView = inflater.inflate(R.layout.popup_layout,...
final PopupWindow popup = new PopupWindow(popUpView,...
popup.setContentView(popUpView);
popup.showAtLocation(v, Gravity.CENTER_HORIZONTAL, -10, 100);
...
btnSaveRecord = (Button) popUpView.findViewById(R.id.btnSaveRecordxml);
btnSaveRecord.setOnClickListener(new View.OnClickListener(){
        public void onClick(View v){saveRecord(v);
        }});
...
    }
public void saveRecord(View v){
    String szSpecies = edSpeciesLookup.getText().toString();            
    if(szSpecies.matches("")){          
    }else{
        db.execSQL("INSERT INTO speciesLookupDb (species) VALUES ('"+szSpecies+"')");
        clearForm(v);
    }
  }
//...more delete, update, first, previous, next, and last sql calls.
}

MainActivity class 是,

public class MainActivity extends Activity{
    public static Context appContext;
...
public speciesPopupWindow speciesPopupWindow;
    @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
...
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.corax, menu);
    return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menuitem_editSpeciesTable:
            editSpeciesTable(null);
            return true;
    }
    return false;
}
//2/13- Adjusted editSpeciesTable below per suggested answer.
public void editSpeciesTable(View v){
    LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    PopupWindow speciesPopupWindow = new PopupWindow(inflater.inflate(R.layout.popup_layout, null, false),500,500,true);
    speciesPopupWindow.showAtLocation(this.findViewById(R.id.fragment_placeholder), Gravity.CENTER, 0, 0);
//shows popup_layout.xml layout fine...but how to call speciesPopupWindow.init() for sql logic?
}
}

speciesPopupWindow 的屏幕截图:

当前的问题与在 speciesPopupWindow 中实现 SQL 和其他方法有关...如何从 MainActivity 中的 onOptionsItemSelected 中的 case-switch 语句调用这些?

提前致谢。

正在将 MainActivity 中的 editSpeciesTable 更改为...

public void editSpeciesTable(){
    new speciesPopupWindow(MainActivity.this).init();
}

导致 speciesPopupWindow.class 正常工作。谢谢