Android Question Program bombs when I select a country from a list of countries

aedwall

Active Member
Licensed User
Longtime User
I don't understand what is happening. This program used to work and now it has an issue. I display a list of countries and ask the user to select a country. Sometimes, not always, as soon as I click on a radio button int he list, the program bombs and closes. It seems to happen when I get out of this routine:

I try to set breakpoints, but I think the error is in the internal code as I never get an error message when the problem happens. When the error occurs it never seems to show the virtual keyboard. It does this with bra v13.10 or v13.40.

Does anyone have any ideas about this? I am using two different libraries for my various settings: Dialogs2 and Better Dialogs.

When I check my Google Play account, I also see these messages, which I do not understand:

[libinput.so] android::InputChannel::receiveMessage(android::InputMessage*)

[libutils.so] android::sp<android::Thread>::clear()

[libandroid_runtime.so] android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)

[libc.so] abort

Code::
  res = InputList(List2, "Choose birth state/country", 0)   'display list of countries & get user selection

  selected_country = country_list(res)                'get user country selection
 
  If res = 122 Then selected_country = "Georgi"       'use abbreviation so it doesn't get confused with Georgia, the US state
   
  EditText21.Visible = False
 
  txtCity.Background = cd1

  btnUpdateCity.Visible = True
  txtCity.Visible = True

  txtCity.RequestFocus
  IME1.ShowKeyboard(txtCity)
End Sub
 
Last edited:

LucasHeer

Active Member
Licensed User
Longtime User
Hey sir!

Would you possible be able to upload a sample project with the crash issue?

I would love to take a look at it!
 
Upvote 0

aedwall

Active Member
Licensed User
Longtime User
Hey sir!

Would you possible be able to upload a sample project with the crash issue?

I would love to take a look at it!
astrowin.org/NatalCharts_b4a.zip

Put the 2 "SE_v201" files in "Libraries_added".

I think everything is included that is needed. It does not happen all the time. Click "M", then "Change natal data 1" or "Change natal data 2". Then select any state or country (I usually just select "Arizona"). Sometimes it will bomb or sometimes it will show the page to enter the city name, which means it did not bomb. It bombs selectively. Yet I see just now that it did go to the "enter city name" page, but then bombed, using an emulator.
 
Upvote 0

LucasHeer

Active Member
Licensed User
Longtime User
astrowin.org/NatalCharts_b4a.zip

Put the 2 "SE_v201" files in "Libraries_added".

I think everything is included that is needed. It does not happen all the time. Click "M", then "Change natal data 1" or "Change natal data 2". Then select any state or country (I usually just select "Arizona"). Sometimes it will bomb or sometimes it will show the page to enter the city name, which means it did not bomb. It bombs selectively. Yet I see just now that it did go to the "enter city name" page, but then bombed, using an emulator.
Hey sir!

I was able to load your app.

It works perfect on Pixel 9 pro, I did about 35-40 combinations of "Change natal data 1"/"Change natal data 2" and following through with city/county selection.

I will try it on emulator and another device. Does it also crash on release for you?
 
Upvote 0

aedwall

Active Member
Licensed User
Longtime User
What do you mean by "release"?

It sometimes crashes when run on BlueStacks. And sometimes in the emulator I set up using AVD Manager. Thank you for providing the information.
 
Upvote 0

aedwall

Active Member
Licensed User
Longtime User
You shouldn't use the old modal dialogs:
B4X:
  res = InputList(List2, "Choose birth state/country", 0)
Change to InputListAsync.
Doing this made the problem appear more often, so this is apparently not a good way to go. I didn't add any code for "pauses". I don't know if that is needed or not.
 
Upvote 0

LucasHeer

Active Member
Licensed User
Longtime User
1769333496733.png


^ This is the only error I can possibly find, not sure if it is related

main.vb:2137 selected_country = country_list(res) 'get user country selection

I can reproduce this by swiping my screen from the edge to go back.

You can add something like this to fix that issue in particular. Might check if that is your main issue:
B4X:
    If(res < 0) Then
        ToastMessageShow("Cancelling...", False)
        Return
    End If
    selected_country = country_list(res)                'get user country selection
 
Upvote 0

aedwall

Active Member
Licensed User
Longtime User
View attachment 169566

^ This is the only error I can possibly find, not sure if it is related

main.vb:2137 selected_country = country_list(res) 'get user country selection

I can reproduce this by swiping my screen from the edge to go back.

You can add something like this to fix that issue in particular. Might check if that is your main issue:
B4X:
    If(res < 0) Then
        ToastMessageShow("Cancelling...", False)
        Return
    End If
    selected_country = country_list(res)                'get user country selection
Thanks for your idea. I will see if I can add it and go from there. Just tried it and the program still crashes, giving no error information at all, that I can see. Now it crashes even before I see the list of countries. But the operation is intermittent with respect to how it acts. It crashes in different ways, at different points. But never an error message.
 

Attachments

  • Clipboard_01-25-2026_01.jpg
    Clipboard_01-25-2026_01.jpg
    12.7 KB · Views: 56
Last edited:
Upvote 0

LucasHeer

Active Member
Licensed User
Longtime User
Thanks for your idea. I will see if I can add it and go from there. Just tried it and the program still crashes, giving no error information at all, that I can see. Now it crashes even before I see the list of countries. But the operation is intermittent with respect to how it acts. It crashes in different ways, at different points. But never an error message.

Yes sir, I wish that I could experience the crash. I tried Pixel 9 pro, Samsung Tab, and emulator and no luck!

If you would like, I could switch your code over to the "modal" style of dialog that I use in B4X. It operates similar to how dialogs work in HTML/JS with modals.
 
Upvote 0

aedwall

Active Member
Licensed User
Longtime User
It's interesting how a user had a problem on his device, and I have sporadic issues on my end, using an emulator or a Samsung Galaxy Tab A or on BlueStacks - and you have no issues at all, on multiple devices. I suppose if you want to experiment, then why not? You might also try changing the transit time zone, as I have had occasional sporadic failures with that as well. From the code replacements I have made, the problem does not seem to lie in the InputList or InputListAsync commands. Thank you for your help.
 
Upvote 0
Top