package com.slidingmenu.lib.app;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.ListView;
import android.widget.RelativeLayout;

import com.slidingmenu.lib.R;
import com.slidingmenu.lib.SlidingMenu;

public class SlidingActivityHelper {

	private Activity mActivity;

	private SlidingMenu mSlidingMenu;
	private ViewGroup mContentView;
	private boolean mContentViewCalled = true;
	private boolean mBehindContentViewCalled = true;

	public SlidingActivityHelper(Activity activity) {
		mActivity = activity;
	}

	public void onCreate(Bundle savedInstanceState) {
		// unregister the current content view
		mActivity.getWindow().getDecorView().findViewById(android.R.id.content).setId(View.NO_ID);
		// register a new content view
		mContentView = new RelativeLayout(mActivity);
		mContentView.setId(android.R.id.content);

		// customize based on type of Activity
		if (mActivity instanceof SlidingListActivity) {
            ListView lv = new ListView(mActivity);
            lv.setId(android.R.id.list);
            mContentView.addView(lv, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        }

		// set up the SlidingMenu
		mSlidingMenu = (SlidingMenu) LayoutInflater.from(mActivity).inflate(R.layout.slidingmenumain, null);
		mSlidingMenu.setViewAbove(mContentView);
		mSlidingMenu.setBackgroundDrawable(mActivity.getWindow().getDecorView().getBackground());
		mActivity.getWindow().setContentView(mSlidingMenu);
	}

	public void onPostCreate(Bundle savedInstanceState) {
		if (!mContentViewCalled || !mBehindContentViewCalled) {
			throw new IllegalStateException("Both setContentView and " +
					"setBehindContentView must be called in onCreate.");
		}
	}
	
	public void setBehindContentView(View v, LayoutParams params) {
		if (!mBehindContentViewCalled) {
			mBehindContentViewCalled = true;
		}
		mSlidingMenu.setViewBehind(v);
	}
	
	public SlidingMenu getSlidingMenu() {
		return mSlidingMenu;
	}
	
	public void toggle() {
		if (mSlidingMenu.isBehindShowing()) {
			showAbove();
		} else {
			showBehind();
		}
	}

	public void showAbove() {
		mSlidingMenu.showAbove();
	}

	public void showBehind() {
		mSlidingMenu.showBehind();
	}

	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK && mSlidingMenu.isBehindShowing()) {
			showAbove();
			return true;
		}
		return false;
	}

}

@@ -531,52 +531,8 @@
 ew;%0A
-%09private boolean mContentViewCalled = true;%0A
 %09pri
@@ -571,19 +571,20 @@
 alled = 
-tru
+fals
 e;%0A%0A%09pub
@@ -1660,31 +1660,8 @@
 if (
-!mContentViewCalled %7C%7C 
 !mBe
@@ -1730,37 +1730,8 @@
 oth 
-setContentView and %22 +%0A%09%09%09%09%09%22
 setB
@@ -1762,16 +1762,26 @@
  called 
+%22 +%0A%09%09%09%09%09%22
 in onCre
@@ -1783,16 +1783,46 @@
 onCreate
+ in addition to setContentView
 .%22);%0A%09%09%7D

Make sure setBehindContentView is called in onCreate