BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-11-2005, 04:13 PM   #1 (permalink)
New Member
 
Join Date: Aug 2005
Model: SK65
Carrier: T-mobile
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default RecordStore problems

Please Login to Remove!

Hello,

I'm having trouble with a CLDC application: it performs a few actions automatically on startup via a static method (it doesn't actually start its GUI), one of which is to register a class as a listener for the INBOX folder.

When the class's messagesAdded method is invoked in response to a message being received, it looks in the RecordStore to get some information.

The problem is, the information is placed in the RecordStore at another point in the code, when the GUI is running, and for some reason the two accesses to the RecordStore return different objects. The information always gets stored in the RecordStore, and the returned id is incremented as expected, but when I try to read the information back out, it fails, because the RecordStore is pointing to a different place.

The documentation says that RecordStores are specific to Midlets, so I'm not sure how that applies to my CLDC application.

Can anyone help?

Thanks in advance,

Leo Shaw
Offline  
Old 08-12-2005, 07:30 AM   #2 (permalink)
New Member
 
Join Date: Aug 2005
Model: SK65
Carrier: T-mobile
Posts: 12
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

In case anyone else has similar issues: the problem seems to be that the listener class gets called from a different context than the main application. The RecordStore used by the application wasn't visible to the listener even when it was opened with AUTHMODE_ANY.
My temporary solution is pass the open RecordStore to the listener's constructor - this seems to work fine, but it means keeping the store open and there's no way to close it (no finalize).
The only satisfactory long-term solution I can think of is to create a thread class that performs all access to this RecordStore (opening and closing it for each operation), and start it running in the app's startup code. The thread would read the IDs of the elements in the RecordStore to be operated on from a Vector or similar in the RuntimeStore.

-------------------------
Leo Shaw
http://www.leoshaw.co.uk
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.