Math

Answered

Width and Height of math editor image getting 0

I am trying to get image of editor through:
Bitmap b = mWidget.getResultAsImage();
but sometime it get width and height of the image 0 and app crashes.Following are the errors:

Fatal Exception: java.lang.IllegalArgumentException
width and height must be > 0

android.graphics.Bitmap.createBitmap (Bitmap.java:922)
android.graphics.Bitmap.createBitmap (Bitmap.java:868)
com.myscript.atk.math.widget.export.PictureExporter.generateData (PictureExporter.java:43)
com.myscript.atk.math.widget.controller.MathWidgetController.getResultAsImage (MathWidgetController.java:600)
com.myscript.atk.math.widget.MathWidget.getResultAsImage (MathWidget.java:343)
com.dd.fosterlearning.EquationEditor.EquationSolvingActivity.getEEData (EquationSolvingActivity.java:234)
com.dd.fosterlearning.EquationEditor.EquationSolvingActivity.access$100 (EquationSolvingActivity.java:42)
com.dd.fosterlearning.EquationEditor.EquationSolvingActivity$3.onClick (EquationSolvingActivity.java:135)
android.view.View.performClick (View.java:4654)
dalvik.system.NativeStart.main (NativeStart.java)


Best Answer

Dear Sulman,

Thank you for your question.

Can you confirm you are calling the getResultAsImage function in the onRecognitionEnd function?

Indeed, this function is called when you have a result ; if you do not have a result, it is likely you will not get an image.

I also recommend you have a look to the following topic: https://developer-support.myscript.com/support/discussions/topics/16000007927

Best regards,

Olivier

1 Comment

Answer

Dear Sulman,

Thank you for your question.

Can you confirm you are calling the getResultAsImage function in the onRecognitionEnd function?

Indeed, this function is called when you have a result ; if you do not have a result, it is likely you will not get an image.

I also recommend you have a look to the following topic: https://developer-support.myscript.com/support/discussions/topics/16000007927

Best regards,

Olivier