General questions

add image issue in latest sdk

Hi, after adding image in the editor, image gets added. resized it using finger and then trying to move image upwards. it cashes with below log:
Fatal Exception: java.lang.IllegalStateException: NO_SUCH_OBJECT: 

       at com.myscript.iink.NativeFunctions.pointerUp(NativeFunctions.java)

       at com.myscript.iink.Editor.pointerUp(Editor.java:459)

       at com.myscript.iink.uireferenceimplementation.InputController.handleOnTouchForPointer(InputController.java:141)

       at com.myscript.iink.uireferenceimplementation.InputController.onTouch(InputController.java:175)

       at android.view.View.dispatchTouchEvent(View.java:11784)

       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)

       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2647)

       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)

       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)

       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)

       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)

       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)

       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)

       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)

       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)

       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)

       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)

       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)

       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)

       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2974)

       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2661)

       at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:549)

       at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1953)

       at android.app.Activity.dispatchTouchEvent(Activity.java:3559)

       at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)

       at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)

       at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:502)

       at android.view.View.dispatchPointerEvent(View.java:12027)

       at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5304)

       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5093)

       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4588)

       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4641)

       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4607)

       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4734)

       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4615)

       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4791)

       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4588)

       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4641)

       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4607)

       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4615)

       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4588)

       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7195)

       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7169)

       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7130)

       at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7351)

       at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:192)

       at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)

       at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:181)

       at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:7274)

       at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:7379)

       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:981)

       at android.view.Choreographer.doCallbacks(Choreographer.java:790)

       at android.view.Choreographer.doFrame(Choreographer.java:715)

       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:967)

       at android.os.Handler.handleCallback(Handler.java:808)

       at android.os.Handler.dispatchMessage(Handler.java:101)

       at android.os.Looper.loop(Looper.java:166)

       at android.app.ActivityThread.main(ActivityThread.java:7529)

       at java.lang.reflect.Method.invoke(Method.java)

       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)

       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)


Dear Dipannita,


thank you for contacting us.


Currently on which Android flavor is it occuring? Indeed, I was not able to get this crash on my Android device, so it may be related to a specific Android version.


Meanwhile, you can catch the exception in the handleOnTouchForPointer when calling the Editor.pointerUp function ; this will prevent your application from crashing.


Best regards,


Olivier

Hi Olivier,
I am using Android 11, Samsung S6.
This issue is continous. Also repositioning of image in the editor is not working.
All these were working fine with 1.3.1 Myscript.
In 1.4.1 these issues came up.

Hi Olivier,
The image can be resized in the editor but it cannot be moved from a position to another.
Thos was working fine in 1.3
This is the function we call after receving the filepath of an image:


private boolean addImage(String filePath) {
try {
float subblocksYMax = 0;
float height = 0;
ContentBlock[] blocks = editorView.getEditor().getRootBlock().getChildren();

for (int i = 0; i < blocks.length; i++) {
float blockY = blocks[i].getBox().y;
if (subblocksYMax < blockY) {
subblocksYMax = blockY;
height = blocks[i].getBox().height;
}
}
float ymax = subblocksYMax + height;
Point point = new Point(0.0f, ymax + 5.0f);
Transform v = editorView.getEditor().getRenderer().getViewTransform();
v.apply(point);
if (!TextUtils.isEmpty(filePath)) {
File file = new File(filePath);

if (file != null) {
MimeType mimeType = null;

for (MimeType mimeType_ : MimeType.values()) {
if (!mimeType_.isImage())
continue;

String fileExtensions = mimeType_.getFileExtensions();

if (fileExtensions == null)
continue;

String[] extensions = fileExtensions.split(" *, *");

for (int i = 0; i < extensions.length; ++i) {
if (file.getName().endsWith(extensions[i])) {
mimeType = mimeType_;
break;
}
}
}

if (mimeType != null) {
editorView.getEditor().addImage(point.x, point.y, file, mimeType);
editorView.getEditor().waitForIdle();
a = a + (int) point.y;
editorView.getRenderer().setViewOffset(point.x, a);
editorView.getRenderer().getRenderTarget().invalidate(editorView.getRenderer(), EnumSet.allOf(IRenderTarget.LayerType.class));
}
}
} else {
editorView.getEditor().addBlock(point.x, point.y, "Drawing");
editorView.getEditor().waitForIdle();
editorView.getRenderer().setViewOffset(point.x, point.y);
editorView.getRenderer().getRenderTarget().invalidate(editorView.getRenderer(), EnumSet.allOf(IRenderTarget.LayerType.class));
}
} catch (Exception e) {
Toast.makeText(PatientChiefComplaint.this, "Failed to add image", Toast.LENGTH_LONG).show();
}
editorView.getRenderer().getRenderTarget().invalidate(editorView.getRenderer(), EnumSet.allOf(IRenderTarget.LayerType.class));

return true;
}

Dear Dipannita,


Currently, are you still getting the exception? If so, I guess catching it prevented the crashes from occurring?


Indeed, our test team found a similar issue, in which an image added in a Text Document could not be moved ; but the difference is that we did not have any exception raised (and no crash). We tried to reproduce your exact use-case, but never got the exception raised.


At present, the status is that the error we had on our side has been fixed, and will be delivered in the next release (at present, we cannot commit with the release date) ; although your issue seems similar to the one we had, we hope it will solve it but cannot guarantee 100% (due to the fact we never reproduced teh same exact issue).


Best regards,


Olivier

HI Olivier,
Thank You for your reply.
Crash has been prevented by by putting pointer up listener in try catch.
But the movement of the image is a problem.
Any ways as said by you, it will be given in next release.

Login or Signup to post a comment