title: Best way to implement a google+ like slide out menu?
body: <p>I am a newbie android developer who is  trying to build an application which uses a fly in menu(similar to  google+, fb, steam, youtube). I found <a href="https://github.com/jfeinstein10/SlidingMenu" rel="nofollow">https://github.com/jfeinstein10/SlidingMenu</a>  works well for my needs. Now my question is , what is the most efficent way to to use this library</p>
  
  <p>This is one of my activities</p>
  
  <pre><code>public class ExampleActivity2 extends SlidingActivity implements OnItemClickListener{
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          setBehindContentView(R.layout.list);
          getSlidingMenu().setBehindOffsetRes(R.dimen.actionbar_home_width);
          Button btn = (Button) findViewById(R.id.button);
  
          //ListClass l=new ListClass(getApplicationContext());
  
          ListView lv=(ListView) findViewById(R.id.lvname);
          String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
                    "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
                    "Linux", "OS/2" };
          ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,
                    android.R.layout.simple_list_item_1, android.R.id.text1, values);
  
                  // Assign adapter to ListView
                  lv.setAdapter(adapter); 
                  lv.setOnItemClickListener(this);
                  getActionBar().setHomeButtonEnabled(true);
      }
  
      @Override
      public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) {
          switch(arg2){
          case 1:
              Intent myIntent = new Intent(this,TestClass.class);
              startActivity(myIntent);
              break;
  
          }
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          switch (item.getItemId()) {
              case android.R.id.home:
                  // app icon in action bar clicked; go home
                 toggle();
                  return true;
              default:
                  return super.onOptionsItemSelected(item);
          }
      }
  
  }
  </code></pre>
  
  <p>As u you can see, this implementation requires me to populate the side menu for every activity that I use it. 
  (In this example , when the user chooses item 1 from the side menu, I start a new activity called TestClass where I have to populate the listview  and implement the onitemlistener again).</p>
  
  <p>I want a way to move the whole listView code(with the onitemclicklistener) to a seperate file that can be called for all activities(the detail views).I tried to move the code to a different class but eclipse throws a  null point exception error. I would highly appreciate it if someone can guide me with an example on how to use this library(I didnt find the samples very useful). Thanks in advance :)</p>