Sub Activity_Create(FirstTime As Boolean)
'Loading the main activity
Activity.LoadLayout("Activity")
'for loading save
LoadSavedData
'Request all the permissions
RequestAllPermissions
'for Material Components
Sleep(0) '<-Added this to let the activity load completely to resolve the crash, although it still occurs
InitializeMaterialComponents '<-Sub for Initializing NavDrawer
'... Other Activity code
End Sub
Sub InitializeMaterialComponents
NavDrawer.Initialize2("NavDrawer", Activity, NavDrawer.DefaultDrawerWidth, NavDrawer.GRAVITY_START)
'^ The crash happens on this line.
NavDrawer.InitDrawerToggle
NavDrawer.NavigationView.LoadLayout("navheaderLayout", NavDrawer.DefaultHeaderHeight)
addNavigationConponents '<Adds Menu items to navdrawer
End Sub