Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code> @Override public boolean onPrepareOptionsMenu(Menu menu){ //You need to pass the menu to open menu method openMenu(menu); return true; } // private void openMenu(Menu menu){ //that menu can not be null View popUpView = getLayoutInflater().inflate(R.layout.menu, menu); popUpMenu = new PopupWindow(popUpView, LayoutParams.FILL_PARENT , LayoutParams.WRAP_CONTENT , true); popUpMenu.setBackgroundDrawable(new BitmapDrawable()); popUpMenu.setAnimationStyle(android.R.style.Animation_Dialog); popUpMenu.showAtLocation(popUpView, Gravity.BOTTOM, 0, 0); makePopUpMenuButtons(popUpView); } </code></pre> <p>Try <a href="http://developer.android.com/guide/topics/ui/menus.html" rel="nofollow">option menu</a></p> <p>Read this <strong>Changing menu items at runtime</strong> paragraph in above link for your second query</p> <p><strong>Edit:</strong></p> <pre><code>@Override public boolean onPrepareOptionsMenu(Menu menu) { // TODO Auto-generated method stub menu.clear(); menu.add(0, MENU_Unsubscribe, Menu.NONE, "Pop UP"); return super.onPrepareOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub if (item.getItemId() == MENU_Unsubscribe) { View popUpView = getLayoutInflater().inflate(R.layout.activity_new, null); btnOK=(Button)popUpView.findViewById(R.id.btnOK); popUpMenu = new PopupWindow(popUpView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, false); // popUpMenu.setBackgroundDrawable popUpMenu.setAnimationStyle(android.R.style.Animation_Dialog); popUpMenu.showAtLocation(popUpView, Gravity.CENTER, 0, 0); popUpMenu.setOutsideTouchable(true); btnOK.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub popUpMenu.dismiss(); } }); } return super.onOptionsItemSelected(item); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload