Menu doesn't appear after linking to another page with phonegap
I use phonegap,
When linking to another page with simple href my menu stop working.
In my Java class I override onKeyDown() and return false for menu button
@Override
public boolean onKeyDown(int i,KeyEvent e){
if (i==KeyEvent.KEYCODE_MENU){
return false;
}else{
return true;
}
}
When I loadUrl fr开发者_运维知识库om the java class I can open the menu (in about.html)
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.exit:
this.finish();
return true;
case R.id.about:
super.loadUrl("file:///android_asset/www/about.html");
return true;
default:
return super.onOptionsItemSelected(item);
}
}
精彩评论