Think i make a simple mistake but i dont see what.
CboFlashmode is a spinner filled with 4 values (auto, on, off and torch) and depending on the value you select the camera will be set to that value.
But in the code below its goes always to the else statement even when the value is 1 of the 3 other values.
What do i wrong?
B4X:
Sub cboFlashMode_ItemClick (Position As Int, Value As Object)
Dim sWaarde As String = cboFlashMode.SelectedItem.ToUpperCase
Select sWaarde
Case "ON"
camera1.FlashOn
Case "OFF"
camera1.FlashOff
Case "TORCH"
camera1.FlashTorch
Case Else
camera1.FlashAuto
End Select
End Sub
i did try that before but then get the error 'Unknown type: Object' when i compile. Think i have to convert Value to string first but didnt find the command for that yet.
I also tried with Sub cboFlashMode_ItemClick (Position As Int, Value As string) instead of Sub cboFlashMode_ItemClick (Position As Int, Value As Object)
then value.touppercase works but dont solve my problem.
How did you populate the Spinner ?
You could also use:
B4X:
Sub cboFlashMode_ItemClick (Position As Int, Value As Object)
Dim sWaarde As String = cboFlashMode.SelectedItem.ToUpperCase
Select Position
Case 0
camera1.FlashOn
Case 1
camera1.FlashOff
Case 2
camera1.FlashTorch
Case Else
camera1.FlashAuto
End Select
End Sub
I polulate it with code below but the regex isnt good and i still have to look at it.
I use the AdvancedCamera lib.
B4X:
Dim lFlashModes As List = camera1.SupportedFlashMode
If lFlashModes.IsInitialized = False Then
cboFlashMode.Add("<Flash not supported>")
cboFlashMode.Enabled = False
Else
' fill spinner
cboFlashMode.AddAll(Regex.Split("\,",lFlashModes))
End If