title: how to implement sliding menu to work in android
body: <p>i got sliding menu lib <a href="https://github.com/jfeinstein10/SlidingMenu" rel="nofollow">here</a> &amp; i want both left and right slide menu to come based on operation, in my case always left to right slide comes irrespective of the icon click. here is the code</p>
  
  <p>where is the problem?. how to make both slide to work?</p>
  
  <pre><code>package com.example.simple_left_right_slider;
  
  import android.os.Bundle;
  import android.app.ActionBar;
  import android.app.Activity;
  import android.support.v4.app.FragmentActivity;
  import android.view.Menu;
  import android.view.MenuItem;
  
  import com.actionbarsherlock.app.SherlockFragmentActivity;
  
  import com.slidingmenu.lib.SlidingMenu;
  
  
  public class MainActivity extends  FragmentActivity{
  
      private SlidingMenu menu;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          ActionBar actionBar = getActionBar();
          actionBar.setDisplayHomeAsUpEnabled(true);
  
          menu = new SlidingMenu(this);
          menu.setTouchModeAbove(SlidingMenu.LEFT_RIGHT);
          menu.setMode(SlidingMenu.LEFT_RIGHT);
          menu.setShadowWidthRes(R.dimen.shadow_width);
          //menu.setShadowDrawable(R.drawable.shadow);
          menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
          menu.setFadeDegree(0.35f);
          menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
          menu.setMenu(R.layout.menu_frame);
          getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.menu_frame, new SampleListFragment())
            .commit();
  
          menu.setSecondaryMenu(R.layout.menu_frame1);
  
          getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.menu_frame1, new SampleListFragment())
            .commit();
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.mainmenu, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected (MenuItem item)
      {
          switch (item.getItemId()) {
  
            case android.R.id.home:
              menu.toggle();
              break;
  
            case R.id.github:
              menu.toggle();
              break;
  
          }
          return super.onOptionsItemSelected(item);
  
      }
  
  }
  </code></pre>