Android Question Spinner causes crash upon LoadLayout

ValDog

Active Member
Licensed User
Longtime User
I have a dialog that is crashing immediately upon calling LoadLayout. There is one spinner on the dialog, and if I remove it, the dialog loads just fine. If I add the spinner back into the dialog, it crashes as before.

Error message starts with:

srccheck_activity_create (B4A line: 25)
Activity.LoadLayout("SrcTest")
java.lang.RuntimeException: java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead
.
.
.
.

Please help!


Update: I added the subject dialog to a bare bones test app, and it loads just fine - so I am now really baffled with this issue...

Update2: I'd been adding the spinner with the Designer. As I noted before, when I remove the spinner and run the program the dialog comes up just fine. If I then proceed to add the spinner in code (with AddView) the dialog seems to be OK. Go figure... I have a number of dialogs with Designer installed spinners and this is the first time I've encountered this problem.
 
Last edited:

ValDog

Active Member
Licensed User
Longtime User
Can you post your Spinner_Click code
I'm not sure how this would affect my issue, but here it is:

Sub spnRefTitle_Click (Position As Int, Value As Object)
Dim sTemp As String
Dim i As Int

sRefTitle = Value

sTemp = "SELECT * FROM SrcCkRef" & " WHERE RefID = '" & Value & "'"
Main.Cursor1 = Main.SQL1.ExecQuery(sTemp)
Main.Cursor1.Position = 0

lblCntTime.Text = Main.Cursor1.GetString("RefCountTime")
lblTolerance.Text = Main.Cursor1.GetString("RefTolerance")
lblRefCounts.Text = Main.Cursor1.GetString("RefCounts")

Main.Cursor1.Close

btnCheck.Enabled = True
End Sub
 
Upvote 0
Top