Android Question SlidingMenu, AppCombat and multiple activities

David Meier

Active Member
Licensed User
Longtime User
Hi
I used Erel's example for appcombat with toolbar and jFeinstein's slidingMenu:
https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/#content

This example is great (thx Erel) but I wonder how one can extend it correctly with multiple activities. I tried to do it and attached my sample.
I have a question though:

What about the transitions from one activity to the next. In my example the transition is slow because I close the side menu before starting the new activity
B4X:
sm.HideMenus
StartActivity("pageTwo")
If I do not use sm.HideMenus then the transition is fast but when going back the side menu will be still open.
Maybe my whole approach is wrong and I beg your pardon, as I am still new to android ;)
Thanks for your much-appreciated contribution and help!
David
 

Attachments

  • appCompat_twoActivities.zip
    13.5 KB · Views: 270

Erel

B4X founder
Staff member
Licensed User
Longtime User
Tip:
B4X:
StartActivity("pageTwo") 'not good
StartActivity(pageTwo) 'good

You can use this code to hide the side menu immediately (without animation):
B4X:
Dim jo As JavaObject = sm
jo.RunMethod("showContent", Array(False))

The best place to put it is in Activity_Resume. This way there is no interface changes during the transition.
 
Upvote 0

David Meier

Active Member
Licensed User
Longtime User
Thanks a lot Erel. That's cool. I wish I knew all these tricks ;)

I think with the side menu closed immediately this boilerplate works best (fast). Animation would certainly be a nice feature but it is not absolutely necessary.

Kind regards
David

Tip:
B4X:
StartActivity("pageTwo") 'not good
StartActivity(pageTwo) 'good

You can use this code to hide the side menu immediately (without animation):
B4X:
Dim jo As JavaObject = sm
jo.RunMethod("showContent", Array(False))

The best place to put it is in Activity_Resume. This way there is no interface changes during the transition.
 
Upvote 0

Similar Threads

Top