Android Question Signature matching error

Peter Lewis

Active Member
Licensed User
Longtime User
Firstly Thank you to DonManfred for coding this signature block



I am getting these errors when combining multiple apps into one app.

** Activity (signcap) Create, isFirst = true **
** Activity (signcap) Resume **
An error occurred:
(Line: 0) End Sub
java.lang.Exception: Sub activity_create signature does not match expected signature.
public static anywheresoftware.b4a.pc.RemoteObject com.dia.stock.signcap_subs_0._activity_create(anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception


This is the signapp activity


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

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

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 Button1 As Button
    Private sign As SignatureDialogBuilder
    Private img As ImageView

End Sub

Sub Activity_Create(FirstTime As Boolean)

    Activity.LoadLayout("layout1")

End Sub

Sub Button1_Click
    sign.Show("Signature","SIGN HERE!","OK","Cancel",File.DirRootExternal,"Signature.png")
End Sub
Sub Signature_onSignatureEntered()
    Log($"onSignatureEntered()"$)
    If File.Exists(File.DirRootExternal,"Signature.png") Then
        Dim bmp As Bitmap
        bmp.Initialize(File.DirRootExternal,"Signature.png")
        img.Bitmap = bmp
    End If
End Sub
Sub Signature_onSignatureInputCanceled()
    Log($"onSignatureInputCanceled()"$)
End Sub
Sub Signature_onSignatureInputError(error As String)
    Log($"onSignatureInputError(${error})"$)
  
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


and Button 4 is where it is called from



B4X:
#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#End Region
'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
    Dim job2 As HttpJob
  
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 Button1 As Button
    Dim myABBarcode As ABZxing
    Dim MyWaybill As ABZxing

    Dim MyPhone As PhoneId
    Dim CustName As String
    Dim WayBill As String

    Private Button2 As Button
    Private Button3 As Button
    Private Button4 As Button
  

  
End Sub

Sub Activity_Create(FirstTime As Boolean)
  
    Activity.LoadLayout("peterbarcodetest")

  
End Sub

Sub Read_Barcode_update(Value As String)
    CustName = Value
  
    End Sub

Sub Activity_Resume
  
End Sub

Sub Activity_Pause (UserClosed As Boolean)
  
End Sub

Sub Button1_Click(Value As String)
    CustName = Value
    myABBarcode.ABGetBarcode("myabbarcode", "")
End Sub

Sub MyWaybill_BarcodeFound (WbarCode As String, formatName As String)

    WayBill = WbarCode
  
End Sub



Sub myABBarcode_BarcodeFound (barCode As String, formatName As String)
    mResult = barCode

End Sub

Sub myABBarcode_Canceled()
    mResult = "Canceled"
  
End Sub

Sub MyWaybill_Canceled()
    WayBill = "Canceled"
  
End Sub

Sub JobDone (Job As HttpJob)
    Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
    If Job.Success = True Then
        CallSubDelayed(Main, "Activity_Resume")
    Else
        Log("Error: " & Job.ErrorMessage)
        ToastMessageShow("Error: " & Job.ErrorMessage, True)
    End If
    Job.Release
End Sub

Sub Button4_Click
    CallSubDelayed(signcap, "Activity_Create")
  
    End Sub
  




Sub Button2_Click
    MyWaybill.ABGetBarcode("mywaybill", "")
  
    job2.Initialize("Job2", Me)
    job2.PostString("http://www.himel.co.za/sen_post.php","Barc="&mResult&"&Location="&CustName&"&Waybill="&WayBill&"&User="&MyPhone.GetSimSerialNumber&"")
End Sub

Sub Button3_Click
  
    WayBill = ""
    job2.Initialize("Job2", Me)
    job2.PostString("http://www.himel.co.za/sen_post.php","Barc="&mResult&"&Location="&CustName&"&Waybill="&WayBill&"&User="&MyPhone.GetSimSerialNumber&"")
End Sub


If you have any ideas why I am getting this , please let me know, thx
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use CallSubDelayed to start an activity. It is in fact very useful as you can call a sub in the other activity and pass information.
Using CallSubDelayed to interact between activities and services

Calling Activity_Create is less useful and indeed should be avoided. However the issue in your program is that you need to use CallSubDelayed2 if you are calling a sub that expects a parameter.
 
Upvote 0
Top