Daydah
Daydah

Reputation: 371

How to solve 'Storage not Initialized' errors in lwuit?

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?

Upvotes: 2

Views: 272

Answers (1)

Shai Almog
Shai Almog

Reputation: 52760

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.

Upvotes: 2

Related Questions