I have an activity that is called via this code
Main.iVacationRowId = Value 'Variable is declared in MAIN
StartActivity("VacationEdit")
The "VacationEdit" activity is started as displayed in the log.
In the Activity_Create sub, I load my layout which is fine, Copy the SQL database if needed and turn off some captions. Here is the code:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("VacationDisplay")
If FirstTime = True Then
Main.targetDirectory = DBUtils.CopyDBFromAssets ("dCruiseVacation.sqlite")
SQL1.Initialize (Main.targetDirectory, "dCruiseVacation.sqlite", True)
LoadVendorFromTable
End If
lblCruiseShipCaption.Visible = False
spShipName.Visible = False
lblReturnDateCaption.Visible = False
lblReturnDate.Text = ""
End Sub
In the Activity_Resume sub,
I check to see if the value of MAIN.iVacationRowId > 0, if it is, I read a record from the database and display it. This works fine.
If the value is actually zero (it is -- in the log I write the value), then I don't do anything, except hopefully display the form for data entry.
The code is a IF-ELSE-ENDIF structure.
If Main.iVacationRowId > 0 then
.....Read Database
.....Display the Record
Else
.....Do Nothing
Endif
Here's the interesting part -- if I code a statement like MSGBOX("TEST","") between the Else and Endif, the popup is displayed and when clicked through, the form is displayed. If I don't code anything between ELSE/ENDIF, I get this error in the log.
java.lang.NullPointerException
at anywheresoftware.b4a.agraham.reflection.Reflection$7.onTouch(Reflection.java:1100)
at android.view.View.dispatchTouchEvent(View.java:4605)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1320)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1709)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1264)
at android.app.Activity.dispatchTouchEvent(Activity.java:2315)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1682)
at android.view.View.dispatchPointerEvent(View.java:4677)
at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2392)
at android.view.ViewRoot.handleMessage(ViewRoot.java:2054)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4123)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native Method)
Can anyone help me out? Please, if I didn't provide enough detail, please let me know.
I've attached the source code to the post.
Thanks.
Main.iVacationRowId = Value 'Variable is declared in MAIN
StartActivity("VacationEdit")
The "VacationEdit" activity is started as displayed in the log.
In the Activity_Create sub, I load my layout which is fine, Copy the SQL database if needed and turn off some captions. Here is the code:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("VacationDisplay")
If FirstTime = True Then
Main.targetDirectory = DBUtils.CopyDBFromAssets ("dCruiseVacation.sqlite")
SQL1.Initialize (Main.targetDirectory, "dCruiseVacation.sqlite", True)
LoadVendorFromTable
End If
lblCruiseShipCaption.Visible = False
spShipName.Visible = False
lblReturnDateCaption.Visible = False
lblReturnDate.Text = ""
End Sub
In the Activity_Resume sub,
I check to see if the value of MAIN.iVacationRowId > 0, if it is, I read a record from the database and display it. This works fine.
If the value is actually zero (it is -- in the log I write the value), then I don't do anything, except hopefully display the form for data entry.
The code is a IF-ELSE-ENDIF structure.
If Main.iVacationRowId > 0 then
.....Read Database
.....Display the Record
Else
.....Do Nothing
Endif
Here's the interesting part -- if I code a statement like MSGBOX("TEST","") between the Else and Endif, the popup is displayed and when clicked through, the form is displayed. If I don't code anything between ELSE/ENDIF, I get this error in the log.
java.lang.NullPointerException
at anywheresoftware.b4a.agraham.reflection.Reflection$7.onTouch(Reflection.java:1100)
at android.view.View.dispatchTouchEvent(View.java:4605)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1554)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1320)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1709)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1264)
at android.app.Activity.dispatchTouchEvent(Activity.java:2315)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1682)
at android.view.View.dispatchPointerEvent(View.java:4677)
at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2392)
at android.view.ViewRoot.handleMessage(ViewRoot.java:2054)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4123)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native Method)
Can anyone help me out? Please, if I didn't provide enough detail, please let me know.
I've attached the source code to the post.
Thanks.