SlidingMenu icon indicating copy to clipboard operation
SlidingMenu copied to clipboard

Keep SlidingMenu opened after orientation changes

Open ghost opened this issue 14 years ago • 4 comments

Hi,

I have a MainActivity which extends SlidingFragmentActivity. I cant succeed in keeping the menu opened after an orientation change.

I have seen two methods in SlidingMenu which could be interesting for my problem :

  • onSaveInstanceState
  • onRestoreInstanceState

but never called :(

many thanks anyway for the library

flavien

ghost avatar Nov 17 '12 11:11 ghost

I'm hitting this problem too and it's also present in the sample app. It doesn't appear to be straight-forward to store whether the menu is open by using onSaveInstanceState in my activity as showAbove() is called in the GlobalLayoutListener defined in SlidingMenu.

laurencerackham avatar Jan 07 '13 11:01 laurencerackham

you can open the menu by yourself on the onResume / onStart function with

if(!getSlidingMenu().isMenuShowing()) {
getSlidingMenu().toggle(); } this will toggle the menu if it is not shown.

akkawi avatar Jan 17 '13 20:01 akkawi

In the latest version of the code it will keep track of this. Just pull the code and use the Sliding*Activities

jfeinstein10 avatar Jan 17 '13 20:01 jfeinstein10

How is this done without using the Sliding*Activity?

I'm currently using onSaveInstanceState and onRestoreInstanceState to keep track of whether it's open or not which isn't ideal.

[edit] I see it's done as above. I.e. there's no support for this without using the base activities. Ho hum.

denevell avatar Feb 25 '13 10:02 denevell