Android Question PlacesAutocompleteView not working in panels

Mike1970

Well-Known Member
Licensed User
Longtime User
There must be an error in the logs. In some cases the debug app crashes before it completes sending the logs. In that case the error should appear when you run the app again.
OK, i noticed that the Debugger is not working anymore at all actually
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
There must be an error in the logs. In some cases the debug app crashes before it completes sending the logs. In that case the error should appear when you run the app again.
Ok now i see the logs xD

I describe to you the scene..
I have Two modules, with a button i go from the Main module to the Home module (calling StartActivity(Home)), then in Home i have few buttons that each one loads a layout in a panel (pnlContent).

when i click the button to load the layout with the AutocompleteView it crashes and give me this error:

Error occurred on line: 109 (PlacesAutocompleteView)
java.lang.RuntimeException: Object should first be initialized (ListView).

But i saw that in the "initialize" event of the class there is the function:

lv.initiliazie("lv")

So.. i don't understand
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
It would help if you upload a small project which shows the issue instead of giving five answers...

Ok, i understood how to replicate the error, here you are the small project.
let me know if you spot something
 

Attachments

  • ListViewERROR.zip
    14 KB · Views: 272
Upvote 0

Willian Padilha

Member
Licensed User
Hi this is my first interaction with the forum , in Class Module (PlacesAutoCompleteView) uncomment line 21 in Sub Initialize and comment line 36, or move line 36 before this line, example below

B4X:
et.InputType = Bit.Or(et.INPUT_TYPE_TEXT, 0x00080000)

Now
B4X:
et.InputType = Bit.Or(et.INPUT_TYPE_TEXT, 0x00080000)
lv.Initialize("lv")

expected

B4X:
lv.Initialize("lv")
et.InputType = Bit.Or(et.INPUT_TYPE_TEXT, 0x00080000)

It seems that when you apply InputType to an EditText, the Change method of it is activated
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User


I tried and it crashes again.
Try to unistall the application and install again with "initialize" line above the et.inputtype, and you will see that it crashes again.

Because i noticed that if you modify it, save, and restart the code it will run perfectly (without repacking from scartch), but if you stop, delete the app (restart adb server) and Reinstall WITHOUT change anything in the code, it crashes again D:
 
Upvote 0

Willian Padilha

Member
Licensed User
Try call in first line of Initialize
B4X:
Public Sub Initialize (vCallback As Object, vEventName As String)
    lv.Initialize("lv")
    mEventName = vEventName
    mCallback = vCallback
    et.Initialize("et")
    
    Dim cd As ColorDrawable
    cd.Initialize2(Colors.ARGB(180,255,255,255),5dip,2dip,Colors.RGB(233,233,233))
    
    et.Background = cd
    et.Hint = "Cerca il luogo di stage"
    et.HintColor = Colors.Gray
    et.SingleLine = True
    
    'Remove the suggestions bar
    'lv.Initialize("lv")
    et.InputType = Bit.Or(et.INPUT_TYPE_TEXT, 0x00080000)
.......................
.............
...
and comment other Initialize of lv Object
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User


It was one of the first things i tried... but i don't know why after some restart-run it gave problem again.

Now i uncomment the line at the begininng of the Initialize Sub, and it's not crashing (at the moment) and it's giving this error:

Unexpected event (missing RaiseSynchronousEvents): et_textchanged
Check the unfiltered logs for the full stack trace.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…