Spanish Como activar autofocus [Enfoque] en QRCodeReaderView

bgsoft

Well-Known Member
Licensed User
Longtime User
Hola:

Pero al descargar el proyecto de ejemplo, no me corre la apk

Que quieres decir con eso? yo la probé y funciona. No se si viste que un poco mas abajo de los primeros zip hay otro ejemplo.

Saludos
 

ebqlabs

Active Member
Licensed User
Hola:



Que quieres decir con eso? yo la probé y funciona. No se si viste que un poco mas abajo de los primeros zip hay otro ejemplo.

Saludos


Si, los baje y al instalar la apk y probarlo me sale error de java

upload_2017-11-9_10-6-43.png


Entonces no puedo probar la apk para ver como funcionar el auto-enfoque.


Favor, si puedes enviarme el ejemplo o si sabes sobre el error.
No se si va por el tema del diseño, ya que abro y me arroja erro en B4A

Espero su respuesta, saludos.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Si, los baje y al instalar la apk y probarlo me sale error de java

View attachment 61497

Entonces no puedo probar la apk para ver como funcionar el auto-enfoque.


Favor, si puedes enviarme el ejemplo o si sabes sobre el error.
No se si va por el tema del diseño, ya que abro y me arroja erro en B4A

Espero su respuesta, saludos.
Can you post the full B4A Log when the error occurs?
 

ebqlabs

Active Member
Licensed User
Cuando abro el proyecto en B4A me aperece esto en el log

upload_2017-11-10_9-47-35.png



Cuando abro el diseño, aparece esto:

upload_2017-11-10_9-48-30.png



Tal vez sea por el diseño.
Si es posible, me pueden enviar un ejemplo en B4A.


Saludos.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Cuando abro el proyecto en B4A me aperece esto en el log

View attachment 61531


Cuando abro el diseño, aparece esto:

View attachment 61532


Tal vez sea por el diseño.
Si es posible, me pueden enviar un ejemplo en B4A.


Saludos.
What Version of B4A are you using? You might have to use a more recent version of AppCompat (such as 3.20). Seems like the layout file is also missing?
 

ebqlabs

Active Member
Licensed User
What Version of B4A are you using? You might have to use a more recent version of AppCompat (such as 3.20). Seems like the layout file is also missing?

AppCompat = version 2.0

Y el diseño, no viene en el proyecto cuando lo descargue.

Saludos.
 

Johan Schoeman

Expert
Licensed User
Longtime User
B4A = 5.02(1)
Tendré que probarlo con esa versión de B4A para ver cuál es el problema. El proyecto B4A se basa en la última versión de B4A y utiliza AppCompat V3.20
 

Johan Schoeman

Expert
Licensed User
Longtime User
Vea si puede comenzar con el proyecto B4A adjunto
Tome nota del archivo de manifiesto B4A
La vista, los botones y la casilla de verificación se agregan mediante el código B4A y no mediante el uso del Diseñador

upload_2017-11-10_19-44-18.png


Código de muestra:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4NewQRCodeReaderView
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region


#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

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

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private nqrcrv As NewQRCodeReaderView
    Private Button1 As Button
    Private torchOn As Boolean = False
 
    Private Button2 As Button
    Private Button3 As Button
 
    Private prevscan As String  = ""
'    Private Label1 As Label
    Private CheckBox1 As CheckBox
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("main")

    nativeMe.InitializeContext
    nqrcrv.Initialize("nqrcrv")
    Button1.Initialize("Button1")
    Button2.Initialize("Button2")
    Button3.Initialize("Button3")
    CheckBox1.Initialize("CheckBox1")
 
 
    Activity.AddView(nqrcrv, 0%x, 0%y, 100%x, 100%x)
    Activity.AddView(Button2, 2%x, 100%x + 2%y, 31%x, 15%y)
    Activity.AddView(Button1, 35%x, 100%x + 2%y, 35%x, 15%y)
    Activity.AddView(Button3, 72%x, 100%x + 2%y, 31%x, 15%y)
    Activity.AddView(CheckBox1, 2%x, 100%y - 10%y, 15%x, 10%y)
 
    Button1.Color = Colors.Green
    Button1.Text = "Torch"
    Button1.TextColor = Colors.Black
    Button1.TextSize = 15
    Button1.Typeface = Typeface.DEFAULT_BOLD
 
    Button2.Color = Colors.Yellow
    Button2.Text = "Start Scan"
    Button2.TextColor = Colors.Black
    Button2.TextSize = 15
    Button2.Typeface = Typeface.DEFAULT_BOLD
 
    Button3.Color = Colors.Cyan
    Button3.Text = "Stop Scan"
    Button3.TextColor = Colors.Black
    Button3.TextSize = 15
    Button3.Typeface = Typeface.DEFAULT_BOLD
 
 
 
    nqrcrv.QRDecodingEnabled = True
    nqrcrv.AutofocusInterval = 500
    nqrcrv.ScanNow = False
    nqrcrv.Visible = False
    nqrcrv.ResultPointColor = Colors.Red
    CheckBox1.Checked = False
 

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
 
    torchOn = False
    CheckBox1.Checked = False
    nqrcrv.stopCamera
    prevscan = ""

End Sub


Sub nqrcrv_result_found(retval As String)
 
    If prevscan = retval Then
       'Log("same scan")
       prevscan = retval
    Else
       Log("b4aResult = " & retval)
        prevscan = retval
        nativeMe.RunMethod("playTone", Null)
    End If
 
End Sub

Sub Button1_Click
    If nqrcrv.Visible = True Then
        If torchOn = False Then
            nqrcrv.TorchEnabled = True
            torchOn = True
        Else
            nqrcrv.TorchEnabled = False
            torchOn = False
         
        End If 
    End If
 
End Sub

Sub Button2_Click
 
    nqrcrv.Visible = True
    nqrcrv.setBackCamera
    nqrcrv.startCamera
 
End Sub

Sub Button3_Click
 
    nqrcrv.Visible = False
    CheckBox1.Checked = False
    nqrcrv.stopCamera
    prevscan = ""
 
End Sub

Sub CheckBox1_CheckedChange(Checked As Boolean)
 
    If Checked = True Then
        nqrcrv.ScanNow = True
    Else
        nqrcrv.ScanNow = False
    End If
 
End Sub


#if Java

import android.media.ToneGenerator;
import android.media.AudioManager;

  public void playTone() {
      final ToneGenerator tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100);
      tg.startTone(ToneGenerator.TONE_PROP_BEEP);
  }   

#End If

2.png
 

Attachments

  • b4aNewQRCodeReaderView.zip
    7.7 KB · Views: 235

Johan Schoeman

Expert
Licensed User
Longtime User
El proyecto adjunto utiliza el diseñador B4A para agregar la vista personalizada, los botones y la casilla de verificación
No he agregado código de script de diseñador para posicionar las vistas correctamente
Debería funcionar con B4A V5.02 (1)
 

Attachments

  • b4aNewQRCodeReaderView.zip
    9 KB · Views: 237

ebqlabs

Active Member
Licensed User
El proyecto adjunto utiliza el diseñador B4A para agregar la vista personalizada, los botones y la casilla de verificación
No he agregado código de script de diseñador para posicionar las vistas correctamente
Debería funcionar con B4A V5.02 (1)

Gracias, lo probare y comentare.
 
Top