JavaFXPorts - 更改场景会导致无效的接触点ID错误

时间:2016-05-02 07:57:37

标签: javafxports gluon-mobile

我有一个有2个场景的应用程序。应用程序从第一个场景开始(设置为全屏模式),当我点击屏幕上的一个点时,它会切换到第二个场景(也设置为全屏)。

当我在Windows上运行它时,它运行正常。当我在Android上运行它时,切换到第二个场景后出现错误。第二个场景在屏幕上弹出,然后在logcat中崩溃并出现以下异常:

java.lang.RuntimeException: Platform reported wrong touch point ID
                                                             at javafx.scene.Scene$TouchMap.get(Scene.java:5455)
                                                             at javafx.scene.Scene$ScenePeerListener.touchEventNext(Scene.java:2716)
                                                             at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$null$361(GlassViewEventHandler.java:1148)
                                                             at com.sun.javafx.tk.quantum.GlassViewEventHandler.access$lambda$20(GlassViewEventHandler.java)
                                                             at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$23.run(Unknown Source)
                                                             at java.security.AccessController.doPrivileged(AccessController.java:52)
                                                             at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleNextTouchEvent$362(GlassViewEventHandler.java:1127)
                                                             at com.sun.javafx.tk.quantum.GlassViewEventHandler.access$lambda$17(GlassViewEventHandler.java)
                                                             at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$20.get(Unknown Source)
                                                             at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:391)
                                                             at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleNextTouchEvent(GlassViewEventHandler.java:1126)
                                                             at com.sun.glass.ui.View.handleNextTouchEvent(View.java:579)
                                                             at com.sun.glass.ui.View.notifyNextTouchEvent(View.java:1050)
                                                             at com.sun.glass.ui.TouchInputSupport.notifyNextTouchEvent(TouchInputSupport.java:141)
                                                             at com.sun.glass.ui.monocle.TouchInput.dispatchPoint(TouchInput.java:131)
                                                             at com.sun.glass.ui.monocle.TouchInput.lambda$postPoint$82(TouchInput.java:155)
                                                             at com.sun.glass.ui.monocle.TouchInput.access$lambda$3(TouchInput.java)
                                                             at com.sun.glass.ui.monocle.TouchInput$$Lambda$4.run(Unknown Source)
                                                             at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
                                                             at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
                                                             at java.lang.Thread.run(Thread.java:818)

任何解决这个问题的建议都会很棒。

这是build.gradle文件,如下所示:

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.javafxports.jfxmobile'

dependencies {
    compile project(':Util')
    compile files('D:/DevTools/minimal-json/minimal-json7.jar')     
    compile files('D:/DevTools/sqlite-jdbc/sqlite-jdbc-3.8.11.2.jar')       

    androidRuntime 'org.sqldroid:sqldroid:1.0.3'                
} 

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'org.javafxports:jfxmobile-plugin:1.0.8'
}
}

apply plugin: 'org.javafxports.jfxmobile'

repositories {
jcenter()
}

mainClassName = 'com.myapp.Client'

jfxmobile {

javafxportsVersion = '8.60.7'

android {
    manifest = 'src/android/AndroidManifest.xml'
}
ios {
    forceLinkClasses = [ 'com.myapp.**.*', 'SQLite.**.*']
    infoPList = file('src/ios/Default-Info.plist')
}
}

谢谢!

1 个答案:

答案 0 :(得分:0)

我可以重现你的崩溃,我会提交一个错误。

在桌面上,有几个场景甚至是舞台很常见,在移动设备上并非如此。

相反,我们只有一个阶段,我们不会一直改变场景,只是改变它的内容。

使用Gluon Mobile,有final ThreadPoolExecuter threadPool = Executors.newFixedThreadPool(5); // note the final modifier threadPool.execute(new Runnable() { @Override public void run() { // do something in threadPool thread // call method in thread A getInfo(new QueryExecutorInterface() { @Override public void onPostExecute(Cursor cursor) { threadPool.execute(new Runnable() { // adding another callback so it runs in threadpool @Override public void run() { // do the thing here } }); } }); } }); 个节点,可以准确地说明:使用尽可能多的视图来拥有不同的内容,并在需要时切换。

您可以查看GluonSQLite示例,其中包括SQLite,但它只有一个View,或者其他多视图示例here,如Notes或Comments。