Q:

Override Menu Button action

The Nexus displays the screen as follows:(Here I press on the 3 dots on the top right corner to drop down the menu)

I have a menu appear at the top right corner of the screen.
The phone display the menu as follows(This happens only when I press the menu button on the phone) :

I would like to have the same menu behavior in phone as in the tablet where-in I can show the menu in the top right corner of the screen. My question here is that  is there any way to override the menu inflate behavior where-in the menu has to be displayed from the top right position of the screen even in the phone as well

A:

It is a little complicated, but here is the general idea :
public void showPopup(View v) {
PopupMenu popup = new PopupMenu(this, v);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.layout.menu, popup.getMenu());
popup.show();

}
In this method v is the view by which you want your menu to appear. 
You will need to Override the menu button so that when the user presses it your menu appears. Do the following
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ( keyCode == KeyEvent.KEYCODE_MENU ) {
        //Put the code for an action menu from the top here
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

And then everything else is the same as it is for your normal menu(I think)

