Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Regular Contributor
Posts: 51
Registered: ‎05-25-2012
My Device: Bold 9930
My Carrier: Verizon Wireless
Accepted Solution

Application not working for the first time, but works fine when I close & reopen

This problem might sound very strange.

 

I have written webworks app. which writes data to persistent store and retrieves it back.

 

The problem is that.I install the app and  When I click the 'getFromStorage' button(in index.html) it successfully calls it extension. but nothing happens in the first execution. I mean invoke is not called, hence no subsequent methods are called.

 

But when i close the app & reopen & click on 'getFromStorage' button(in index.html) it successfuly stores & retrives the data. so i mean to say,, the app is working fine in the subsequent execusions.

 

I have set EventLogger to see what is hapennning,  I see that the constructor 'DataFactory' is called followed by 

System data:VM:NPOEr=0x232B1800,t=webworks.storage.persistence.MyObject (this is my Object type, but not actual object,  I want to save to memory)

 

Below is the gist how I am implementing it. 

 

invoke(....){

...

DataFactory() _myObj  = new DataFactory();

_myObj.getFromStorage();// This calls 

...

}

 

 

//Separate class

class DataFactory{

static Vector _data = new Vector();

 

DataFactory(){

some values are set to _data

synchronized(_store)
{
 _store.setContents(_data);
_store.commit();

}

getFromStorage(){

Vector _vectorStore = (Vector) _store.getContents();

}

}

 

 

Any clue, what is going wrong and where?

 

 

 

 

 

 

 

Regular Contributor
Posts: 51
Registered: ‎05-25-2012
My Device: Bold 9930
My Carrier: Verizon Wireless

Re: Application not working for the first time, but works fine when I close & reopen

I found the problem.

 

I was trying to store the Vector() object. But the contents of the Vector were not implemented by Persistable Interface.

Hence it was throwing NonPersistableObjectException.

 

So I implemented Persistable  on  the class (whose objects I was storing).

Now its working fine.