Hi all,
I've got a need to take a barcode from a Custom URL called app.
For some reason this code takes two snaps of the Barcode.
Anyone know enough about
ABZxing and b4a and Custom URL to know why the ABZxing has to have two goes at the barcode?
Also I don't want any layout to show before the barcoding starts.
There is a 1 second showing of a blank layout screen with the label on the top left before the barcode automaticly starts.
Is this normal or is there a way to suppress the 1 seconds blank layout?
This app is a custom url app that is called by a URL "myBarCodeApp://"
I have a calling app in another language that calls this url app
with heaps of parameters to store the barcode number.
Regretably the original language can't take advantage of any dll or external app.
Nor will it access the anroid clipboard.
So I have to send the BarCode app the folder and file name of where to save the barcode.
The calling app monitors that folder for that file name until one apprears.
kinda cludgy but its working.
This app includes the ABZxing version 1 Library:
I've got a need to take a barcode from a Custom URL called app.
For some reason this code takes two snaps of the Barcode.
Anyone know enough about
ABZxing and b4a and Custom URL to know why the ABZxing has to have two goes at the barcode?
Also I don't want any layout to show before the barcoding starts.
There is a 1 second showing of a blank layout screen with the label on the top left before the barcode automaticly starts.
Is this normal or is there a way to suppress the 1 seconds blank layout?
This app is a custom url app that is called by a URL "myBarCodeApp://"
I have a calling app in another language that calls this url app
with heaps of parameters to store the barcode number.
Regretably the original language can't take advantage of any dll or external app.
Nor will it access the anroid clipboard.
So I have to send the BarCode app the folder and file name of where to save the barcode.
The calling app monitors that folder for that file name until one apprears.
kinda cludgy but its working.
This app includes the ABZxing version 1 Library:
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim mResult As String
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.
Dim myABBarcode As ABZxing
Dim gMyPath As String
Dim gMyFile As String
Dim gMykey As String
Dim gMyDTStamp As String
Dim gMyBarCode As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Activity.LoadLayout("ABBarcodeTest")
'Label1.Text = mResult
Dim myIntent
myIntent = Activity.GetStartingIntent
If myIntent.Length = 0 Then
Return
End If
'Label2.Text = Activity.GetStartingIntent
Dim myIntentDat As String
myIntentDat = Activity.GetStartingIntent
If InStr(myIntentDat,"dat=")< 0 Then
Return
End If
If InStr(myIntentDat,"cmp=")< 0 Then
Return
End If
Dim myPath As String
myPath = ExtractBetween(myIntentDat,"Path:", "&")
myFile = ExtractBetween(myIntentDat,"File:", "&")
Dim myDTStamp As String
myDTStamp = ExtractBetween(myIntentDat,"DTStamp:", "&")
myDTStamp = myDTStamp.Replace("%20", " " )
Dim myKey As String
myKey = ExtractBetween(myIntentDat,"Key:", "=")
myKey = myKey.Replace("%20", " " )
gMyPath = myPath
gMyFile = myFile
gMyDTStamp = myDTStamp
gMykey = myKey
myABBarcode.ABGetBarcode("myabbarcode", "")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub myABBarcode_BarcodeFound (barCode As String, formatName As String)
'Label1.Text = barCode
mResult = barCode
gMyBarCode = barCode
ReturnMyBarCodeResponse
End Sub
Sub myABBarcode_Canceled()
'Label1.Text = "Canceled"
mResult = "Canceled"
gMyBarCode = "Canceled"
ReturnMyBarCodeResponse
End Sub
Sub ReturnMyBarCodeResponse
Dim myPath As String
myPath = Mid(gMyPath, 13, gMyPath.Length - 13)
If gMyBarCode = "Canceled" Then
File.MakeDir(File.DirRootExternal, gMyPath)
File.WriteString(File.DirRootExternal, myPath & "/" & gMyFile, gMyDTStamp & ":" & gMykey & "=" & gMyBarCode)
Activity.Finish
'Return
End If
Dim result As Int
result = Msgbox2(gMyBarCode, "Please verify the Barcode number:", "OK", "Cancel", "Try Again", Null )
If result = DialogResponse.Positive Then
File.MakeDir(File.DirRootExternal, gMyPath)
File.WriteString(File.DirRootExternal, myPath & "/" & gMyFile, gMyDTStamp & ":" & gMykey & "=" & gMyBarCode)
Activity.Finish
'Return
End If
If result = DialogResponse.Cancel Then
gMyBarCode = "Canceled"
File.MakeDir(File.DirRootExternal, gMyPath)
File.WriteString(File.DirRootExternal, gMyPath & "/" & gMyFile, gMyDTStamp & ":" & gMykey & "=" & "Canceled")
Activity.Finish
'Return
End If
If result = DialogResponse.Negative Then
myABBarcode.ABGetBarcode("myabbarcode", "")
Return
End If
End Sub
Sub InStr(StrVar As String,SearchStr As String)As Long 'Same as At()
'*** Function by RBSoft
Dim x As Long
x = StrVar.IndexOf(SearchStr)
Return x
End Sub
Sub MB(Message As String)
Msgbox(Message, "")
End Sub
Sub Left(Text As String, Length As Long)As String
If Length>Text.Length Then Length=Text.Length
Return Text.SubString2(0, Length)
End Sub
Sub Right(Text As String, Length As Long) As String
If Length>Text.Length Then Length=Text.Length
Return Text.SubString(Text.Length-Length)
End Sub
Sub Mid(Text As String, Start As Int, Length As Int) As String
If Len(Text) = 0 Then
Return ""
End If
Return Text.SubString2(Start-1,Start+Length-1)
End Sub
Sub Trim(Text As String) As String
Return Text.Trim
End Sub
Sub Len(Text As String) As Long
Return Text.Length
End Sub
Sub ExtractBetween(ExtractFrom As String, StartingWith As String, EndingAt As String) As String
If ExtractFrom.Length = 0 Then
Return "Nothing to Extract"
End If
'Sub Mid(Text As String, Start As Int, Length As Int) As String
If InStr(ExtractFrom, StartingWith) > -1 Then
Else
Return StartingWith & " - not found"
End If
If InStr(ExtractFrom, EndingAt) > -1 Then
Else
Return EndingAt & " - not found"
End If
Dim myStartPos As Int
myStartPos = InStr(ExtractFrom, StartingWith)
myStartPos = myStartPos + StartingWith.Length + 1
Dim myLength As Int
myLength = ExtractFrom.Length - myStartPos + 1
Dim myVarWithLeftRemoved As String
myVarWithLeftRemoved = Mid(ExtractFrom, myStartPos, myLength)
myStartPos = 1
myLength = InStr(myVarWithLeftRemoved, EndingAt)
Dim myVarWithRightRemoved As String
'Sub Left(Text As String, Length As Long)As String
myVarWithRightRemoved = Left(myVarWithLeftRemoved, myLength )
Dim myVar As String
myVar = Trim(myVarWithRightRemoved)
'Msgbox ("*" & myVar & "*","")
Return myVar
End Sub
Last edited: