如何解决“存储未初始化”的问题lwuit 中的错误?

发布于 2024-12-26 04:56:05 字数 513 浏览 1 评论 0原文

我已成功将我的 LWUIT 应用程序移植到 Blackberry、触摸式和非触摸式以及 MIDP。我也能够移植到 Android,但它只是加载。之后,对 Storage 的任何调用都会出现以下错误:

发生内部应用程序错误:java.lang.RuntimeException: call com.sun.lwuit.io.Storage.init(myActivity)< /code> 在使用存储机制之前!

我在代码中有存储调用的任何地方都添加了这段代码:

if(!(Storage.isInitialized())) {
    Storage.init(thestore);
}

thestore 是在代码开头声明的 String,无论存储名称是什么,在本例中是 Activity 名称。它仍然不加载存储。请问我还可以做什么呢?也许我需要激活一些权限或者什么?

I have successfully ported my LWUIT app to Blackberry, touch and non touch, and MIDP. I have been able to port to Android as well, but it just loads. After that, any call to Storage gives me this error:

An internal application error occured: java.lang.RuntimeException: call com.sun.lwuit.io.Storage.init(myActivity) before using the storage mechanism!

I have added this bit of code everywhere there is a storage call in my code:

if(!(Storage.isInitialized())) {
    Storage.init(thestore);
}

thestore is a String declared at the very beginning of the code, to whatever the storage name is, and in this case its the Activity name. It still does not load storage. Please what else do I do? Maybe there is some permission I need to activate or something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅忆流年 2025-01-02 04:56:05

存储初始化在不同的平台上需要不同的东西,特别是在 Android 上,它需要来自活动的上下文对象。仅在 Display.init() 之后调用它一次并为其提供活动实例。

Codename One 将消除这些麻烦,只保留 Display.init() 。

Storage init requires different things in different platforms specifically on Android it requires a context object from the activity. Only invoke it once after Display.init() and give it the activity instance.

Codename One will eliminate the need for these hassles and only leave Display.init() in place.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文