SlidingMenu icon indicating copy to clipboard operation
SlidingMenu copied to clipboard

SlidingListActivity - need android.R.id.list (possible fix included)

Open indieboyalex opened this issue 14 years ago • 5 comments

In order to prevent the following error I made the following modification to SlidingActivityHelper which seems to work. Not sure if there are better ways to achieve the same result but it solves the problem:

    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);

        if (mActivity instanceof SlidingListActivity) {
            ListView lv = new ListView(mActivity);
            lv.setId(android.R.id.list);
            mContentView.addView(lv);
        }

        // 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);
    }

indieboyalex avatar Jul 17 '12 06:07 indieboyalex

I just pushed the change in SlidingListActivity instead of SlidingActivityHelper

jfeinstein10 avatar Jul 17 '12 15:07 jfeinstein10

That doesn't work, as the error is thrown at line 19 of SlidingListActivity. It does work where I had it in SlidingActivityHelper.

indieboyalex avatar Jul 17 '12 16:07 indieboyalex

Just put your fix in. Thanks for that :)

jfeinstein10 avatar Jul 17 '12 18:07 jfeinstein10

Pleasure. Really great project, made my life so much easier. On Jul 17, 2012 7:19 PM, "Jeremy Feinstein" < [email protected]> wrote:

Just put your fix in. Thanks for that :)


Reply to this email directly or view it on GitHub: https://github.com/jfeinstein10/SlidingMenu/issues/13#issuecomment-7044350

indieboyalex avatar Jul 17 '12 18:07 indieboyalex

Thanks! It's all for you guys and the community as a whole

jfeinstein10 avatar Jul 17 '12 18:07 jfeinstein10