以前的形式不会在Codename One上完全消失 [英] Previous form does not completely disappears on Codename One

查看:54
本文介绍了以前的形式不会在Codename One上完全消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Codename One编写的应用程序涉及以一种主要形式显示相机预览。我已经使用本机界面实现使其可以在Android(以后的iOS)上运行。

My app written with Codename One involves showing a camera preview In a main form. I have used the native interface implementation to make it work on Android (iOS later).

该应用程序还包含在应用程序购买中,以升级到完整版本。这就是为什么会定期显示一个表格来建议用户进行升级的原因。他们还可以选择稍后进行升级,这将导致升级到完整版本的表单消失,并使带有照相机预览的主要表单出现。

The app also includes in app purchase to upgrade to full version. That's why a form is shown regularly to suggest the user to upgrade. They can also choose to upgrade later which causes this upgrade to full version form to disappear and make the main form with the camera preview to appear.

有时在真实设备上升级到完整版本表格不会完全消失,并且在主要表格上会让人想起它。在这种情况下,相机预览会显示在屏幕的一部分上,而应用程序按钮不会显示。但是几秒钟后,如果用户触摸屏幕,则主要表单将完全显示,而升级表单的踪影也消失了。

Yet on real devices sometimes the upgrade to full version form does not completely disappears and there are reminiscences of it on the main form. In that case the camera preview is displayed on part of the screen and the app buttons do not show. However after some seconds if the user touch the screen the main form gets completely shown and the reminiscence of upgrade form are gone.

似乎完成了太多工作在用户界面线程上,但是当用户单击按钮以关闭升级表单时,我只是调用 new MainForm(theme).show()。所以这应该可以吗?请注意,CN1模拟器不会显示edt违规(但模拟器中没有相机预览)。

It looks like there may be too much things done on the UI thread but I am just calling new MainForm(theme).show() when the user hits the button to close the upgrade form. So this should be OK shouldn't it? Please note that the CN1 simulator does not show edt violation (but there is no camera preview in the simulator).

还是我必须在MainForm中调用revalidate()将组件添加到布局中之后?我实际上应该怎么做才能使这些回忆消失?

Or do I have to call revalidate () in the MainForm after adding the components into the layout ? What should I do actually to make these reminiscences disappear ?

任何帮助我们都表示感谢,

Any help really appreciated,

推荐答案

似乎已找到解决方案。确实,我有一个本地方法可以初始化相机和Surfaceview。我在EDT上运行此方法,然后显示新的MainForm。

It looks like the solution has been found. Indeed I had a native method that initialized the camera and the surfaceview. I was running this method on the EDT and then showing the new MainForm.

实际上,我在 invokeAndBlock()块中包含了初始化方法。现在看来,这种滞后现象几乎不可见(我看不到)。按照我自己的逻辑,我可以用 invokeAndBlock()将在单独的线程上并在其完全准备好时进行初始化工作这一事实来解释它(因此,照相机和曲面视图是

Indeed I embraced the initialization method in an invokeAndBlock() block. Now it looks like the kind of lag is far less visible (I could not see it). In my own logic I can explain it with the fact that the invokeAndBlock() will do the initialization job on a separate thread and when it's fully ready (so the camera and surfaceview are ready to be shown), the MainForm can be shown.

这是@Shai的实际解决方案吗?

Could it be the actual solution @Shai ?

这篇关于以前的形式不会在Codename One上完全消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆