Sometimes after click on an item of a inputlist it freezes, log:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get ()' on a null object reference
anywheresoftware.b4a.Msgbox at $ DialogResponse.onClick (Msgbox.java:119)
com.android.internal.app.AlertController at $ AlertParams $ 3.onItemClick (AlertController.java:1054)
B4X:
Sub cargaservidores
Dim mylist As List, seleccionado As Int = 0
mylist.Initialize
mylist.Clear
Private cursor1 As Cursor
Private sql1 As SQL
sql1.Initialize(File.DirInternal, "user.db", False)
ime1.Initialize("ime1")
ime1.HideKeyboard
cursor1=sql1.ExecQuery(" select host,activo from salas group by host having activo=1 order by host COLLATE NOCASE")
If cursor1.RowCount> 0 Then
For i=0 To cursor1.RowCount-1
cursor1.Position=i
mylist.Add(cursor1.getstring("host"))
If cursor1.getstring("host")=server Then seleccionado=i
Next
Dim idlist As Int
idlist = InputList(mylist,"Seleccionar servidor",seleccionado)
If idlist>=0 Then
If server<> mylist.Get(idlist) Then
'si el server seleccionado no es el encurso lo carga...
server=mylist.Get(idlist) & ":6667"
log("sub carga server")
End If
End If
End If
sql1.close
cursor1.close
End Sub