gluonhq / attach

GNU General Public License v3.0
48 stars 26 forks source link

Initialize clipboard inside a handler #361

Closed jperedadnr closed 1 year ago

jperedadnr commented 1 year ago

Fixes #341

abhinayagarwal commented 1 year ago

The handler has a delayed time of zero. Can you please explain what purpose does the handler serve?

jperedadnr commented 1 year ago

It is like a "platform.runlater", but you can set the time when it should run. It was already required in some other places of this class for the clipboard too. Mainly it is needed now because of the stack trace that was reported in the issue

10-17 15:04:24.966 26884 26908 D GluonAttach: Util :: Load className com/gluonhq/helloandroid/DalvikDisplayService
10-17 15:04:24.982 26884 26908 F zygote64: java_vm_ext.cc:504] JNI DETECTED ERROR IN APPLICATION: JNI NewStringUTF called with pending exception java.lang.RuntimeException: 
Can't create handler inside thread that has not called Looper.prepare()
10-17 15:04:24.982 26884 26908 F zygote64: java_vm_ext.cc:504]   at void android.os.Handler.<init>(android.os.Handler$Callback, boolean) (Handler.java:203)