For a more extensive example based on Erel's three pages example see
In case anyone is interested I attach a modified version of Erels' ThreePagesExample for B4A only. It demonstrates the following enhancements. 1) B4XMainPage requests a Runtime permission. 2) All three pages have a B4XDrawer menu with some code in B4XPage_CloseRequest to close the Drawer if it...
www.b4x.com
It has a few useful extensions so you can avoid reinventing the wheel.