title: add an existing button to the action bar(show popup button)
body: <p>I made an pause button which opens a popup with 3 buttons, Resume,Music on/off,Reset.</p>
  
  <p>My problem is the button is on the screen and it takes some place and it's also ugly.. I want to put this button on the action bar.. how can I do it?</p>
  
  <p>Here is my button:</p>
  
  <pre><code>&lt;Button
  android:id="@+id/show_popup"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_alignBottom="@+id/button1"
  android:layout_alignLeft="@+id/YouLost"
  android:layout_alignParentRight="true"
  android:background="@drawable/pausesign" /&gt;
  </code></pre>
  
  <p>Here is the popup dialog code:</p>
  
  <pre><code> @Override
   public void onWindowFocusChanged(boolean hasFocus) {
      int[] location = new int[2];
      Button button = (Button) findViewById(R.id.show_popup);
      button.getLocationOnScreen(location);
      p = new Point();
      p.x = location[0];
      p.y = location[1]; }
   private void showPopup(final Activity context, Point p) {
      int popupWidth = 2000;
      int popupHeight = 1200;
      LinearLayout viewGroup = (LinearLayout) context.findViewById(R.id.popup);
      LayoutInflater layoutInflater = (LayoutInflater) context
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View layout = layoutInflater.inflate(R.layout.popup_layout, viewGroup);
      final PopupWindow popup = new PopupWindow(context);
      popup.setContentView(layout);
      popup.setWidth(popupWidth);
      popup.setHeight(popupHeight);
      popup.setFocusable(true);
      int OFFSET_X = 60;
      int OFFSET_Y = 60;
      popup.showAtLocation(layout, Gravity.NO_GRAVITY, p.x + OFFSET_X, p.y + OFFSET_Y);
      Button close = (Button) layout.findViewById(R.id.close);
      Button restart = (Button) layout.findViewById(R.id.restart);
      final Button music = (Button) layout.findViewById(R.id.music);
      musicstop = (Button) layout.findViewById(R.id.musicstop);
      musicstop.setVisibility(View.GONE);
  
      music.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
                mPlayer.pause(); 
                musicstop.setVisibility(View.VISIBLE);
                music.setVisibility(View.GONE);}  });
      musicstop.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {       
                musicstop.setVisibility(View.GONE);
                music.setVisibility(View.VISIBLE);
                  mPlayer.start(); }  });
      close.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
          popup.dismiss(); }  });
      restart.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
              popup.dismiss();
              highscore_int.setText("");
  
              YouLost.setText("Game restarted"); 
              counter=0;
              TimeCounter=0;
              TimeCounter1=0;
              TimeCounter2=0;
              TimeCounter3=0;
              TimeCounter4=0;
              changingTextView.setText(""+counter); 
              button6.setBackgroundColor(Color.rgb(TimeCounter, TimeCounter, TimeCounter));   
              button5.setBackgroundColor(Color.rgb(TimeCounter1*2, TimeCounter1*2, TimeCounter1*2));  
              button4.setBackgroundColor(Color.rgb(TimeCounter2*3, TimeCounter2*3, TimeCounter2*3));  
              button3.setBackgroundColor(Color.rgb(TimeCounter3*4, TimeCounter3*4, TimeCounter3*4));  
              button1.setBackgroundColor(Color.rgb(TimeCounter4*5, TimeCounter4*5, TimeCounter4*5));  
              mPlayer.start();
              } });
      }
  </code></pre>
  
  <p>How can I add this button to the action bar?</p>