Private Sub B4XPage_Created (Root1 As B4XView)
Log("create")
If Not(rp.Check(rp.PERMISSION_ACCESS_FINE_LOCATION)) Then
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
End If
Root = Root1
Root.LoadLayout("splash2")
ImageView1.SetBitmap(xui.LoadBitmapResize(File.DirAssets, "welcome.png", ImageView1.Width, ImageView1.Height, True))
Sleep(1000)
cImei=GenerateID
If File.Exists(File.DirInternal, "Test.db") = False Then
SQL1.Initialize(File.DirInternal, "Test.db", True)
CreateDataBase
Else
SQL1.Initialize(File.DirInternal, "Test.db", True)
End If
cur= SQL1.ExecQuery("select * from test")
If cur.RowCount==0 Then
Root.LoadLayout("reg1") ===> getting error at this line
Else
cur.Position=0
cName=cur.GetString("name")
cPhone=cur.GetString("phone")
Root.LoadLayout("MainPage")
Wait For MapFragment1_Ready
gmap = MapFragment1.GetMap
gmap.GetUiSettings.ZoomControlsEnabled=False
gmap.MyLocationEnabled = True
gmap.TrafficEnabled=False
Do While gmap.MyLocation.IsInitialized = False
'Log("Location not initialized... Sleep a while...")
Sleep(250)
Loop
If gmap.MyLocation.IsInitialized Then
Dim CameraPosition1 As CameraPosition
gmap.MapType=gmap.MAP_TYPE_NORMAL
gmap.MyLocationEnabled = True
CameraPosition1.Initialize(gmap.MyLocation.Latitude,gmap.MyLocation.Longitude, 16)
gmap.MoveCamera(CameraPosition1)
End If
End If
cur.Close
End Sub