Android Question QRCodeReaderView not running on Activity_Create()

AndroidMadhu

Active Member
Licensed User
Hello,
I am trying to run QRCodeReaderView on Activity_Create().
But the Viewer not showing any camera view. No error I found so far.

I am following the below reference....
https://www.b4x.com/android/forum/threads/qrcodereaderview-new-release.82265/

The same code not running at Activity_create().
The below is the code snippet....

B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
'Private qrcrv As QRCodeReaderView
Dim nativeMe As JavaObject
End Sub

Sub Globals

Private Button1 As Button
Private torchOn As Boolean = False
Private prevscan As String   = ""
Private nqrcrv As NewQRCodeReaderView
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")

nativeMe.InitializeContext

nqrcrv.QRDecodingEnabled = True
nqrcrv.AutofocusInterval = 500
nqrcrv.ResultPointColor = Colors.Red
nqrcrv.Visible = True
nqrcrv.setBackCamera
nqrcrv.startCamera
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub nqrcrv_result_found(retval As String)

If prevscan = retval Then
prevscan = retval
Else
Log("b4aResult = " & retval)
prevscan = retval
nativeMe.RunMethod("playTone", Null)
End If

End Sub
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…