Android Question Print to Internal Printer

Martin Fdez

Licensed User
Longtime User
I work the example
When I run this error appears:

java.lang.IllegalArgumentException: expected receiver of type android.device.PrinterManager, but got java.lang.Class<android.device.PrinterManager>

This is my code:

#AdditionalJar: platform_sdk_v2.4.0810

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
End Sub

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

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Callback_Event (MethodName As String, Args() As Object) As Object
    If MethodName = "onSuccess" Then
        ToastMessageShow("Success!!!", True)
    Else If MethodName = "onError" Then
        ToastMessageShow("Error!", True)
    End If
    Return Null
End Sub

Sub GetPrinter As JavaObject
    Dim jo As JavaObject
    Return jo.InitializeStatic("android.device.PrinterManager")
End Sub

Sub GetContext As JavaObject
    Return GetBA.GetField("context")
End Sub

Sub GetBA As JavaObject
    Dim jo As JavaObject
    Dim cls As String = Me
    cls = cls.SubString("class ".Length)
    Return jo.GetFieldJO("processBA")
End Sub

Sub Button1_Click
End Sub
Upvote 0