title: How to open sliding menu on Button's click event?
body: <p>I am implementing sliding menu using this <a href="https://github.com/jfeinstein10/SlidingMenu" rel="nofollow">link</a>. Now it is working perfectly fine if I use this code in <code>onCreate()</code> method.</p>
  
  <p>My simple question is How can I open a slider on button's click event ? </p>
  
  <p>I used following code.</p>
  
  <pre><code>public class MainActivity extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          final SlidingMenu menu = new SlidingMenu(this);
  
          Button mButton = (Button) findViewById(R.id.slidingMenu);
          mButton.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View arg0) {
                  menu.setMode(SlidingMenu.RIGHT);
                  menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
                  menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
                  menu.setFadeDegree(0.5f);
                  menu.attachToActivity(MainActivity.this,
                          SlidingMenu.SLIDING_CONTENT);
                  menu.setMenu(R.layout.activity_menu);
              }
          });
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p>but when I click on a button sliding menu is not getting opened. I am not getting any error. How can I do this ?</p>