如何解决“存储未初始化”的问题lwuit 中的错误?
我已成功将我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
存储初始化在不同的平台上需要不同的东西,特别是在 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.