Question

I’m trying to use the Samsung Spen Sdk in my Android app, however it sometimes causes my app to freeze.

I have uploaded sample code on GitHub(link below) for reference. The app launches an Activity that contains the SCanvasView. The problem comes if the user clicks the launch button multiple times before the new activity loads. If you run the sample code and rapidly tap the “Launch Act” button, it will load the new activity fine. However when you finish that activity the app will freeze.

Any advice on how to fix this?

I'm using Galaxy Note 8.0. & S Pen SDK 2.3

Github Url with sample code: https://github.com/agent8261/SamsungANR

/data/anr/traces.txt from the device:

"main" prio=5 tid=1 SUSPENDED
  | group="main" sCount=1 dsCount=0 obj=0x414479a0 self=0x41437880
  | sysTid=23931 nice=0 sched=0/0 cgrp=apps handle=1074111964
  | state=S schedstat=( 7243993289 957593782 55659 ) utm=305 stm=418 core=3
  at java.lang.VMThread.sleep(Native Method)
  at java.lang.Thread.sleep(Thread.java:1031)
  at java.lang.Thread.sleep(Thread.java:1013)
  at com.samsung.sdraw.AbstractModeContext.dispose(SourceFile:603)
  at com.samsung.sdraw.CanvasView.dispose(SourceFile:2545)
  at com.samsung.sdraw.CanvasView.onDetachedFromWindow(SourceFile:643)
  at android.view.View.dispatchDetachedFromWindow(View.java:12796)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2753)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2753)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2753)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2753)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2753)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2753)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2753)
  at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:2753)
  at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3115)
  at android.view.ViewRootImpl.doDie(ViewRootImpl.java:4815)
  at android.view.ViewRootImpl.die(ViewRootImpl.java:4798)
  at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:355)
  at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:305)
  at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:88)
  at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3574)
  at android.app.ActivityThread.access$1300(ActivityThread.java:150)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1333)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:5279)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
  at dalvik.system.NativeStart.main(Native Method)
Was it helpful?

Solution

I don't know why it happen, but I was able to fix it by ensuring that SCanvasView.setFingerControlPenDrawing() was set to true instead of false in the SCanvasInitializeListener.

Apparently the SCanvasView class can't be started with finger drawing enabled by default.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top