我正在尝试在我的Android应用中使用Samsung Spen Sdk,但有时会导致我的应用冻结。
我已在GitHub(下面的链接)上传了示例代码以供参考。该应用程序启动包含SCanvasView的Activity。如果用户在加载新活动之前多次单击启动按钮,则会出现问题。如果您运行示例代码并快速点击“启动操作”按钮,它将加载新活动。但是,当您完成该活动时,应用程序将冻结。
有关如何解决这个问题的建议吗?
我正在使用Galaxy Note 8.0。 &安培; S Pen SDK 2.3
Github Url,示例代码: https://github.com/agent8261/SamsungANR
来自设备的/data/anr/traces.txt:
"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)
答案 0 :(得分:0)
我不知道为什么会这样,但我能够通过确保在SCanvasInitializeListener中将SCanvasView.setFingerControlPenDrawing()设置为true而不是false来修复它。
显然,默认情况下启用手指绘制无法启动SCanvasView类。