D
Deleted member 103
Guest
Hi,
this code does not normally cause problems with other android versions.
Main-Activity:
Classe Bluetooth:
For a device with Android 8 but there are problems, where can it come from?
Can it be this line at the sub "ShowProgressDialog"?
this code does not normally cause problems with other android versions.
Main-Activity:
B4X:
#Region Subs für die BluetoothVerbindung
Public Sub ChooseDevice(lstDevice As List)
Dim res As Int
res = InputList(lstDevice, Starter.language.value("strSelectBtDevice"), -1)
If res <> DialogResponse.CANCEL Then
smCrono.bluetooth.ConnectToDevice(res)
End If
End Sub
Public Sub ShowProgressDialog(text As String, Show As Boolean)
If Show Then
ProgressDialogShow(text)
DoEvents
'Sleep(1000)
Else
ProgressDialogHide
End If
End Sub
#End Region
Classe Bluetooth:
B4X:
Sub Admin_DiscoveryFinished
CallSubDelayed3(Main,"ShowProgressDialog","",False)
If foundDevices.Size = 0 Then
ToastMessageShow(Starter.language.value("strBluetoothNoFound"), True)
Else
Dim Macfound As NameAndMac
Macfound.Initialize
Dim l As List
l.Initialize
For i = 0 To foundDevices.Size - 1
Dim nm As NameAndMac
nm = foundDevices.Get(i)
l.Add(nm.Name)
If Starter.manager.GetString("BtMacAddress") = nm.Mac Then
Macfound = nm
Exit
End If
Next
If Macfound.Name <> "" Then
ConnectToKnownDevice(Macfound)
Else
CallSubDelayed2(Main,"ChooseDevice",l)
End If
End If
End Sub
Sub ConnectToDevice(index As Int)
connectedDevice = foundDevices.Get(index)
ConnectToKnownDevice(connectedDevice)
End Sub
Sub ConnectToKnownDevice(BtMac As NameAndMac)
connectedDevice = BtMac
CallSubDelayed3(Main,"ShowProgressDialog",Starter.language.value("strBluetoothConnect") & " " & BtMac.Name & " (" & BtMac.Mac & ")",True)
serial1.Connect(BtMac.Mac)
End Sub
For a device with Android 8 but there are problems, where can it come from?
Can it be this line at the sub "ShowProgressDialog"?
B4X:
ProgressDialogShow(text)
DoEvents