I have a working example of printing from a WebView.
I copied it's methods to my app, and made sure to copy the content of #Region ActivityAttributes.
Now I get an error in the line photoPrinter.InitializeNewInstance( :
Error occurred on line: 573 (Main)
java.lang.ClassNotFoundException: android.support$v4$print$PrintHelper
at anywheresoftware.b4j.object.JavaObject.getCorrectClassName(JavaObject.java:288)
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:83)
at java.lang.reflect.Method.invoke(Native Method)
...
I am lost. What can I do to make that code work ?
I will appreciate any help.
I copied it's methods to my app, and made sure to copy the content of #Region ActivityAttributes.
B4X:
Sub PrintBitmap (mybmp As Bitmap)
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim photoPrinter As JavaObject
photoPrinter.InitializeNewInstance("android.support.v4.print.PrintHelper", Array(ctxt))
If photoPrinter.RunMethod("systemSupportsPrint", Null) = True Then
'FIT = 1, FILL = 2
photoPrinter.RunMethod("setScaleMode", Array(1))
photoPrinter.RunMethod("printBitmap", Array("Printer Job Name", _
mybmp, Null))
Else
Log("Printing not supported.")
End If
End Sub
Now I get an error in the line photoPrinter.InitializeNewInstance( :
Error occurred on line: 573 (Main)
java.lang.ClassNotFoundException: android.support$v4$print$PrintHelper
at anywheresoftware.b4j.object.JavaObject.getCorrectClassName(JavaObject.java:288)
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:83)
at java.lang.reflect.Method.invoke(Native Method)
...
I am lost. What can I do to make that code work ?
I will appreciate any help.