application has stopped unexpectedly

Smee

Well-Known Member
Licensed User
Longtime User
I am getting this error after compiling and running a test app. the code is small because i am trying to work out why something does not work in another program. anyway after install and pressing open i get the message 'The application test (process Test.one) has stopped unexpectedly. Please try again. Force close"

The code involved is this

B4X:
Sub Globals
   Dim numPanel As Panel
   Dim lblDescription As Label ' Displays for adding
   Dim lblQty As Label         ' Displays for adding
End Sub

Sub Activity_Create(FirstTime As Boolean)

   Activity.LoadLayout("Splash1")

   numPanel.Initialize("numPanel")   
   Activity.AddView(numPanel,400,330,420,180)
   numPanel.LoadLayout("scr4")
   
   Activity.AddMenuItem("Customers", "mnuCustomers")
   Activity.AddMenuItem("Products", "mnuProducts")
   Activity.OpenMenu

I have re-booted the device but no change
i also commented out everything except the first line which i thought should allow it to work. ZIP.
So where am i going wrong ? :confused:

EDIT:

I changed the package name and label name and it started ok
However, The original problem remains

I see the Splash layout but the numpanel does not display. I know it is there because i positioned it partly over the splash and i see the dark outline of the panel but nothing else still :confused:
 
Last edited:

Widget

Well-Known Member
Licensed User
Longtime User
Does numPanel exist in the Designer for Splash1 layout? If so, then you are defining it twice because you have "numPanel.Initialize("numPanel")" which will create another instance of numPanel.

If numPanel is NOT in Splash1 layout then have you tried:

numPanel.Initialize("numPanel")
SplashPanel.AddView(numPanel) 'Add the newly create numPanel to existing panel

or
numPanel.Parent = SplashPanel 'May work also

Widget
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Thanks for the replies, I was able to solve it using one of Klaus's methods from one of his examples, but i will try those suggestions to see if they work also..

Thanks again

Joe
 
Upvote 0

Widget

Well-Known Member
Licensed User
Longtime User
Thanks for the replies, I was able to solve it using one of Klaus's methods from one of his examples, but i will try those suggestions to see if they work also..

Thanks again

Joe

Joe,
Glad you got it working. Don't forget to post the solution just in case someone else encounters the same problem. Also as kickaha pointed out, my suggestion of numPanel.Parent = SpalshPanel won't work. You will need to use AddView() instead.

Widget
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
the solution i found after studying Klaus example was this,

I split the panel into one layout and put the numbers into another
theh code then read like this

B4X:
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

   '   ************************************************************************************
'                        Number Panel
   Dim pnlNum As Panel
   Dim lblDescription As Label ' Displays for adding
   Dim lblQty As Label         ' Displays for adding

   Dim lvProducts As ListView
   Dim pnlproducts As Panel
'   ************************************************************************************
   Dim ProdName As String

End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("ProductsLayout")   
   pnlProducts.LoadLayout("pnlProducts")
   
   Activity.AddMenuItem("Customers", "mnuCustomers")
   Activity.AddMenuItem("Products", "mnuProducts")
   Activity.OpenMenu
   
End Sub
 
Upvote 0
Top