Search code examples
androidandroid-sliding

How to detect if slide menu is opened or closed using SlideHolder in android


I am using the slideHolder class for using slide menu in my project. I want to get notified in my fragment, when slide is opened or closed. I have tried the following line of code also:

SlideHolder.setOnSlideListener(SlideHolder.OnSlideListener);

But its giving error. How to detect the open and close event of the slide menu?

Any help will be appreciated. Thanks.


Solution

  • You can use a code similar to this. You need to implement your SlideHolderListener.

        sliderMenu.setOnSlideListener(new SlideHolder.OnSlideListener() {
    
                @Override
                public void onSlideCompleted(boolean opened) {
                    if(opened)
                        // do whatever need once menu opened
                    else
                        // do whatever need once menu closed
                }
                });