Android Question QR code scanning error

Denis_kc

New Member
Can someone help me fix the error with the following line:
camera.Initialize("0");

It says: Input string was not in a correct format.

App should scan QR code. The complete code is following:

#Region Project Attributes

'SupportedOrientations possible values: unspecified, landscape or portrait.
#End Region

#Region Activity Attributes
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
Private Const QR_CODE_FORMAT As String = "QR_CODE"
Private scannedData As String
Private camera As Camera
Private scanTimer As Timer
Private result As Result 'Declare the result variable
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Start the camera
camera.Initialize("0");

'Set the camera preview mode
camera.PreviewMode = QR_CODE_FORMAT

'Start the scan timer
scanTimer.Initialize("scanTimer", 100)

'Assign a default value to the result variable
result.Initialize("", Null, Null)
End Sub

Sub Activity_Resume
'Resume the scan timer
scanTimer.Enabled = True
End Sub

Sub Activity_Pause
'Pause the scan timer
scanTimer.Enabled = False
End Sub


Sub scanTimer_Tick
'Get the current camera image
Dim image As Bitmap = camera.GetImage

'Decode the QR code in the image
result = QRCodeReader.Decode(image)

'If a QR code was found, set the scanned data and stop the scan timer
If result.Success Then
scannedData = result.Data
scanTimer.Enabled = False
End If

End Sub

Sub Scan
'Start the scan timer
scanTimer.Enabled = True
End Sub

Sub GetScannedData As String
Return scannedData
End Sub
 
Top