Android Question Application stops when Table is called from Menu Item

Tejwant Navalkar

Member
Licensed User
Longtime User
Hi

I am using the Table class to display SQL lite DB parameters in a Scrollable View.

However,when I call the Table display from the Menu Item,the App stops, giving a message "Unfortunately, APP has stopped".

However, if Iload the same function from layout windows by clicking on a Button, the table is correctly displayed.

Activity.AddMenuItem("Show Table", "ShowTable")
Activity.AddMenuItem("About", "About")
Activity.Title="Cable Sizing File"

....... Other code

Sub ShowTable_Click
DisplayTable
End Sub

Sub ResetButton_Click
DisplayTable
End Sub

The ShowTable_Click gives error
whereas ResetButton_Click works.

Kindly advise.
 

DonManfred

Expert
Licensed User
Longtime User
However,when I call the Table display from the Menu Item,the App stops, giving a message "Unfortunately, APP has stopped".
Look into the unfiltered logs. There must be more info about this issue
 
Upvote 0

Tejwant Navalkar

Member
Licensed User
Longtime User
There is nothing appearing in the log. No error display.

From the activity menu, it runs once, and then shows this error. I think there is some problem of releasing memory.

I faced a similar problem in activity menu click even with Msgbox. Then I changed to ToastmessageShow, which gives no error. I have a feeling, that when Activity menu click occurs, it does not where to return.

However, calling it repeatedly from the button click gives no error at all.
 
Upvote 0

Tejwant Navalkar

Member
Licensed User
Longtime User
No, the table has about 542 rows.

The zip file of the code is enclosed.

Thanks in advance.
 

Attachments

  • CableSizing.zip
    81.7 KB · Views: 212
Upvote 0

klaus

Expert
Licensed User
Longtime User
It works on my device, Sony xperia z1.

You should add this code in the DisplayTable routine.
B4X:
If table1.IsInitialized Then
    'Activity.RemoveAllViews 'remove the current table
    table1.RemoveView
End If
With your original code you added a new Table every time you called the routine.
 
Upvote 0

Tejwant Navalkar

Member
Licensed User
Longtime User
The app still crashes even after adding the lines suggested by you.

The screenshot enclosed.
 

Attachments

  • App_Crash.png
    App_Crash.png
    285.3 KB · Views: 222
Upvote 0

Mahares

Expert
Licensed User
Longtime User
What version of OS are you using and what version of ScrollView 2D are you using? I do not know if this is your problem, but I had a similar situation where I was using ScrollView 2D 2.2 or later that came with ULV and a device with OS 5.0.2. The combination of 5.0.2 and Scrollview 2D 2.2 caused the app to stop. I removed ScrollView2D 2.2 and installed ScrollView2D 1.1 and my problem went away.
 
Upvote 0

Tejwant Navalkar

Member
Licensed User
Longtime User
I have put in breakpoints at each critical step and observed that the app crashes when it tries to display the filled up table. It runs successfully in forming the table.

The break-point log and the code snapshot is enclosed.

Thanks
 

Attachments

  • Log_ScreenShot.png
    Log_ScreenShot.png
    115.7 KB · Views: 218
Upvote 0

Tejwant Navalkar

Member
Licensed User
Longtime User
It is after the call to displaytable in showtable sub

I added table.remove view in table_cellclick. This has improved.the.no.of.times i get the diaplay but still error persists.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
When exactly does the program crash ?
Are you running it in debug mode or in releas mode ?

I had a closer look at your program.
Why do you rebuild the table every time you click on ShowTable ?
You could build it once and hide and show it with the Visible property.
I don't see different tables nor an update of the table somewhere else in the program needing a rebuild ?
The values in the table are the same as in the xls file after LoadTable but are different after ShowTable !?
It seems that the values in the database are different from those in the xls file ?
 
Upvote 0

Tejwant Navalkar

Member
Licensed User
Longtime User
I have run the program in both modes. The program crashes every time I press the Show Table in the menu.

I did not explore the Tables utility much, I will try to build once and then use Visible property.

The table as displayed in ShowTable is sorted, whereas the XLS data is not. I was initially planning to use this show table to debug my app. Then I thought, that I could extend it and keep it for end user also to see the raw values.

Thanks
 
Upvote 0

Tejwant Navalkar

Member
Licensed User
Longtime User
By building once and using visible true/false, the problem is solved :)

That was a little careless of me.

Thanks a lot Klaus. Appreciate your time.

Regards

Tejwant
 
Upvote 0
Top