Persistent Store problem, need your help! ~
Forgive and I would like to make a short story.
Days, I am according to the A13_Storing_Persistent_Data_V2 document and fantasize for only a class useful for my application, but I am failed completely, here is that the source code written in the document.
import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.system.*; import net.rim.device.api.util.*; import java.util.*; public class MusicStores extends UiApplication { private AutoTextEditField namefield; private AutoTextEditField addressfield; private EditField phonefield; private EditField specialtyfield; private static Vector _data; private static PersistentObject store; public static void main(String[] args) { MusicStores app = new MusicStores(); app.enterEventDispatcher(); } public MusicStores() { MainScreen mainScreen = new MainScreen(); mainScreen.setTitle(new LabelField("Favourite Music Store")); namefield = new AutoTextEditField("Store Name: ", ""); addressfield = new AutoTextEditField("Address: ", ""); phonefield = new EditField("Phone Number: ", "", Integer.MAX_VALUE, BasicEditField.FILTER_PHONE); specialtyfield = new EditField("Music Type: ", "", Integer.MAX_VALUE, BasicEditField.FILTER_DEFAULT); mainScreen.add(namefield); mainScreen.add(addressfield); mainScreen.add(phonefield); mainScreen.add(specialtyfield); mainScreen.addMenuItem(saveItem); mainScreen.addMenuItem(getItem); pushScreen(mainScreen); } private MenuItem saveItem = new MenuItem("Save", 110, 10) { public void run() { StoreInfo info = new StoreInfo(); info.setElement(StoreInfo.NAME, namefield.getText()); info.setElement(StoreInfo.ADDRESS, ddressfield.getText()); info.setElement(StoreInfo.PHONE, phonefield.getText()); info.setElement(StoreInfo.SPECIALTY, specialtyfield.getText()); _data.addElement(info); synchronized (store) { store.setContents(_data); store.commit(); } Dialog.inform("Success!"); namefield.setText(null); addressfield.setText(null); phonefield.setText(""); specialtyfield.setText(""); } }; private MenuItem getItem = new MenuItem("Get", 110, 11) { public void run() { synchronized (store) { _data = (Vector) store.getContents(); if (!_data.isEmpty()) { StoreInfo info = (StoreInfo) _data.lastElement(); namefield.setText(info.getElement(StoreInfo.NAME)); addressfield.setText(info.getElement(StoreInfo.ADDRESS)); phonefield.setText(info.getElement(StoreInfo.PHONE)); specialtyfield.setText(info.getElement(StoreInfo.SPECIALTY)); } } } }; static { store = PersistentStore.getPersistentObject(0xdec6a67096f833cL); synchronized (store) { if (store.getContents() == null) { store.setContents(new Vector()); store.commit(); } } _data = new Vector(); _data = (Vector) store.getContents(); } private static final class StoreInfo implements Persistable { private Vector _elements; public static final int NAME = 0; public static final int ADDRESS = 1; public static final int PHONE = 2; public static final int SPECIALTY = 3; public StoreInfo() { _elements = new Vector(4); for (int i = 0; i < _elements.capacity(); ++i) { _elements.addElement(new String("")); } } public String getElement(int id) { return (String) _elements.elementAt(id); } public void setElement(int id, String value) { _elements.setElementAt(value, id); } } }
I put this code into two parts, the first part to record the second part to get info and the info, and they use the same class of StoreInfo, here is the code of the first part.
import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.system.*; import net.rim.device.api.util.*; import java.util.*; public class SaveMusicInfo extends UiApplication { private AutoTextEditField namefield; private AutoTextEditField addressfield; private EditField phonefield; private EditField specialtyfield; private static Vector _data; private static PersistentObject store; public static void main(String[] args) { SaveMusicInfo app = new SaveMusicInfo(); app.enterEventDispatcher(); } public SaveMusicInfo() { MainScreen mainScreen = new MainScreen(); mainScreen.setTitle(new LabelField("Favourite Music Store")); namefield = new AutoTextEditField("Store Name: ", ""); addressfield = new AutoTextEditField("Address: ", ""); phonefield = new EditField("Phone Number: ", "", Integer.MAX_VALUE, BasicEditField.FILTER_PHONE); specialtyfield = new EditField("Music Type: ", "", Integer.MAX_VALUE, BasicEditField.FILTER_DEFAULT); mainScreen.add(namefield); mainScreen.add(addressfield); mainScreen.add(phonefield); mainScreen.add(specialtyfield); mainScreen.addMenuItem(saveItem); mainScreen.addMenuItem(getItem); pushScreen(mainScreen); } private MenuItem saveItem = new MenuItem("Save", 110, 10) { public void run() { StoreInfo info = new StoreInfo(); info.setElement(StoreInfo.NAME, namefield.getText()); info.setElement(StoreInfo.ADDRESS, ddressfield.getText()); info.setElement(StoreInfo.PHONE, phonefield.getText()); info.setElement(StoreInfo.SPECIALTY, specialtyfield.getText()); _data.addElement(info); synchronized (store) { store.setContents(_data); store.commit(); } Dialog.inform("Success!"); namefield.setText(null); addressfield.setText(null); phonefield.setText(""); specialtyfield.setText(""); } }; static { store = PersistentStore.getPersistentObject(0xdec6a67096f833cL); synchronized (store) { if (store.getContents() == null) { store.setContents(new Vector()); store.commit(); } } _data = new Vector(); _data = (Vector) store.getContents(); } private static final class StoreInfo implements Persistable { private Vector _elements; public static final int NAME = 0; public static final int ADDRESS = 1; public static final int PHONE = 2; public static final int SPECIALTY = 3; public StoreInfo() { _elements = new Vector(4); for (int i = 0; i < _elements.capacity(); ++i) { _elements.addElement(new String("")); } } public String getElement(int id) { return (String) _elements.elementAt(id); } public void setElement(int id, String value) { _elements.setElementAt(value, id); } } }
Following is the code of the second part.
import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.system.*; import net.rim.device.api.util.*; import java.util.*; public class GetMusicInfo extends UiApplication { private AutoTextEditField namefield; private AutoTextEditField addressfield; private EditField phonefield; private EditField specialtyfield; private static Vector _data; private static PersistentObject store; public static void main(String[] args) { GetMusicInfo app = new GetMusicinfo(); app.enterEventDispatcher(); } public GetMusicInfo() { MainScreen mainScreen = new MainScreen(); mainScreen.setTitle(new LabelField("Favourite Music Store")); namefield = new AutoTextEditField("Store Name: ", ""); addressfield = new AutoTextEditField("Address: ", ""); phonefield = new EditField("Phone Number: ", "", Integer.MAX_VALUE, BasicEditField.FILTER_PHONE); specialtyfield = new EditField("Music Type: ", "", Integer.MAX_VALUE, BasicEditField.FILTER_DEFAULT); mainScreen.add(namefield); mainScreen.add(addressfield); mainScreen.add(phonefield); mainScreen.add(specialtyfield); mainScreen.addMenuItem(saveItem); mainScreen.addMenuItem(getItem); pushScreen(mainScreen); } private MenuItem getItem = new MenuItem("Get", 110, 11) { public void run() { synchronized (store) { _data = (Vector) store.getContents(); if (!_data.isEmpty()) { StoreInfo info = (StoreInfo) _data.lastElement(); namefield.setText(info.getElement(StoreInfo.NAME)); addressfield.setText(info.getElement(StoreInfo.ADDRESS)); phonefield.setText(info.getElement(StoreInfo.PHONE)); specialtyfield.setText(info.getElement(StoreInfo.SPECIALTY)); } } } }; static { store = PersistentStore.getPersistentObject(0xdec6a67096f833cL); synchronized (store) { if (store.getContents() == null) { store.setContents(new Vector()); store.commit(); } } _data = new Vector(); _data = (Vector) store.getContents(); } private static final class StoreInfo implements Persistable { private Vector _elements; public static final int NAME = 0; public static final int ADDRESS = 1; public static final int PHONE = 2; public static final int SPECIALTY = 3; public StoreInfo() { _elements = new Vector(4); for (int i = 0; i < _elements.capacity(); ++i) { _elements.addElement(new String("")); } } public String getElement(int id) { return (String) _elements.elementAt(id); } public void setElement(int id, String value) { _elements.setElementAt(value, id); } } }
I'm runing the Project One (first part) and record information to be stored, and then I WANT TO runing the project two (part two), but I received an error message telling me there are two same defined the class in the system, I try to change the class name of StoreInfo in two project, the last of error messge disappeared , instead of a CastClassException error, I am so sad...
For a long time debugging I found some interesting things, look at the below codes to two projects, please read the name of the StoreInfor class, not StoreInfo.
private MenuItem getItem = new MenuItem("Get", 110, 11) { public void run() { synchronized (store) { _data = (Vector) store.getContents(); if (!_data.isEmpty()) { StoreInfor info = (StoreInfor) _data.lastElement(); } } } };
Now the _data class name is StoreInfo@xxxxxx (using _data.getClass () .getName ()) and class StoreInfo project two was renamed to StoreInfor, of course, I received a CastClassException error.
I finished the story, and I need some guys to help solve this problem, tks a lot! ~
Creating a descriptor application blackberry project and inside, choose library. Then, each project must refer to this library.
Tags: BlackBerry Developers
Similar Questions
-
Yahoo mail is normally empty. One can type mail in the blank part of . In my case the Compose page has rail logo. because I can't type my mail. Even if there is no problem in gmail-INBO isn't the case with Gmail site "A Google approach to email" or make up may site.
For this reason, it is difficult to compose mail on yahoo mail. I need your help to clear advertising logo so that I can compose mail on a white page, cordially. eldiablo kumarYou can also try to install Adblock Plus with Easylist subscription and check
-
Yester night I tried to improve my S5 iphone for a new virsion so at the end he asked me my icloud and the password I remember my password but not my icloud so I need your help please.
Seems that Apple has temporary problems with their activation servers. Many users report similar problem on older devices.
Latest news: If you can not activate your iPhone, iPad, or iPod touch after installing iOS 9.3 - Apple Support
Hoppefully Apple will highlight the top soon.
-
Please I need your help in the next issue.
Please I need your help in the next issue.
I'm trying to change a driver of function generator to perform the following operations:
starting with the initial value (for example 1 MHz) for some time (for example 10 sec.) and turn off the output for another time (e.g. 20 seconds) and then start again but this time with the frequency increment value (for example 1 MHz + 0.1 x n MHz = 1.1 MHz for n = 1, 2, 3,... n).
The function generator model is ag33xxxGPIB and the link of the driver is http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=E3B19B3E9066659CE034080020E748...
There is no modifications are required for the driver, although there might be an example that you can edit. You use the function of the frequency set in a loop with a shift register. Initialize the registry to offset with the frequency of your departure and each iteration of the loop, add the value of the step. Exit the loop when the stop frequency is reached. Try to write something and after back if you have any problems. Fix what you wrote.
It's pretty basic LabVIEW code. Did you do the online tutorials?
-
I need your help. I forgot my administrator password.
I can connect to my laptop using the standard user account. My problem is I can not change the security settings, tune up and download any program, because somehow the administrators password has been changed and forgotten and I have not a flashdrive password key. Please I need your help. I'm not knowledgeable enough to solve computer problems. Is it possible to recover or reset a new administrator password?
Hello
Microsoft technical support engineers cannot help you recover the passwords of the files and Microsoft who are lost or forgotten product features. For more information about this policy, please see the sticky below:
Thank you
Keith
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think -
Can someone tell me please how to fix programs icon who turned into VLC player? I really need your help guys as soon as possible...
From what you have stated above, I think that the file association for LNK files has been given misdirection to the VLC Player. I've seen this happen when opening a program via a shortcut (for example. LNK file), you are asked what type of program to open it with. After selecting the VLC Player (or another program) via the Select a program from a list of programs installedand check always use the selected program to open this type of file (circled in red below), the document or program referenced by the shortcut of origin opens in VLC Player as it should.The problem is that now all shortcuts (for example. LNK files) on the desktop or in the browser will want to be opened by VLC Player and VLC Player icon to view the shortcut no matter what shortcut was originally intentioned to open. This is known as a file association and the default icon. The same condition can occur if you have performed these actions 'Open with' on one. JPG or even a. EXE, but the. LNK explanation is much more likely for the items on the desktop.
The good news is that a small free utility was written to cancel the. LNK file association was created. There is also a registry hack to achieve, but I recommend the utility unAssoc for its ease of use. I used to send people on another site to download this utility, but this site has become confused with all the ads and fake download links. I put a copy on own OneDrive here.
Just download, then use the utility to unassociate the. LNK files for the user or globally delete the file type and let windows rebuild a new default.
-
buy an iphone 5s by amazon and I came with iCloud blocked an account... I called the seller and does not that I do that I'm from Venezuela please need your help
No one here can help you. The device is locked activation. Since you have made the purchase by Amazon, you can check with them to see if they will stand behind it. No one on the forum, or Apple can help you remove the lock. Only the previous owner can do this. I suggest that you demand a refund, so let's start a claim with Amazon about this dealer.
-
Pavilion 15-n200nx: I need your help
Hello group HP I need your help on activatin windows I update my laptop for windows pro 8.1 build 9600
but is not yet activate every time I open my computer laptop theres always notification that I need to activate my windows
notification require a product key... I have need of your immediately
Thank you.
Hello
The key is in the BIOS of your machine, please use the following tool to get:http://www.Belarc.com/free_download.html
When running this tool, it produced a report, scroll to the section of software management. Product key Windows 8 or 8.1 is there.
You can also use the following tool to discover:
https://www.magicaljellybean.com/KeyFinder/
Kind regards
-
I have always used the windows logo + L key to lock my computer, I remove things from my hard drive and now it locks not for me... need your help :)
Hi ddbowers01,
The other shortcut keys work?
Try pressing CTRL + ALT + DELETE and then try to lock the computer and check.
Check the setting below:
a. in the Control Panel, click user accounts.
b. click on change the way users log on or off the power.
c. Click to uncheck use the screen of welcome for a quick and easy connection.
d. click OK.
With regard to:
Samhrutha G S - Microsoft technical support.
Visit our Microsoft answers feedback Forum and let us know what you think.
-
Hello Sir,
I want to run or install my HP Laserjet P1006 printer to work on my system without the software freely, I have misplaced the software please I need your help.
Thank you
Alex
You can download the software here:
-
I really need your help. How about this one-CNU0092BPK
I really need your help
Hello
In this case, you must enter e9l11o7p2s (3rd character is a lowercase L) to the password screen.
Kind regards
DP - K
-
Update of Windows need your help
Dear community (Microsoft)
I'm on Windows 8 Pro Edition: © 2012 Microsoft Corporations. All rights reserved, I'm getting a massage, at random, every 4 or 5 seconds of my computer, windows update:
"Windows Update needs your help, windows Update was not able to verify the new updates for the last 30 days. Go to windows Update to resolve this issue. "
but I swiched windows update "check for updates but let me choose whether to download and install them" I don't want to upgrade my Windows now... I can't work like this massage coming on screen, yet and still now I can't send a screenshot, please help.
System Configaration: windows 8 pro
32-bit operating * 64 in Prossesor
Hello
You can click here on how to stop or hide the notification for Windows Update. If you want to completely delete or prevent Windows Update, you can click here and find the solution posted by "Mayank Gupta10".
Kind regards.
-
I need your help... Buy a license and do not know if I use it since all the programs you download testing me and departs to download a specific application (Flash) asked me identification information, he placed and are not valid. There are other credentials?
Your subscription to cloud shows correctly on your account page?
If you have more than one email, you will be sure that you use the right Adobe ID?
https://www.adobe.com/account.html for subscriptions on your page from Adobe
.
If Yes
Some general information for a subscription of cloud
Cloud programs don't use serial... numbers you, connect you to your cloud account paying to download & install & activate... you may need to sign out of the cloud and restart your computer and log into the cloud for things to work
Sign out of your account of cloud... Restart your computer... Connect to your paid account of cloud
-Connect using http://helpx.adobe.com/x-productkb/policy-pricing/account-password-sign-faq.html
-http://helpx.adobe.com/creative-cloud/kb/sign-in-out-creative-cloud-desktop-app.html
-http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html
-http://helpx.adobe.com/creative-suite/kb/trial--1-launch.html
-ID help https://helpx.adobe.com/contact.html?step=ZNA_id-signing_stillNeedHelp
-http://helpx.adobe.com/creative-cloud/kb/license-this-software.html
.
If no
This is an open forum, Adobe support... you need Adobe personnel to help
Adobe contact information - http://helpx.adobe.com/contact.html
Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">===>
-Select your product and what you need help with
-Click on the blue box "still need help? Contact us. "
-
Hi, I need your help. I bought your product. But the status is still trail version. so, what should I do?
(1) right click on the Finder on dock icon and select the 'Go - To Folder' option.
(2) you will get a text box, type in below mentioned command and then press 'return './ etc
(3) it will open the etc folder, look for file named "hosts" and the same screenshot of office.
(4) double click on the Hosts file, it will open it with TextEdit.
Let me know if you see any Adobe related as entries in the Hosts file 127.0.0.1 activate.adobe.com... etc?
-
Hello!! I need your help-
I lost the second Activation of my CS5 apps. (probebly didn't remove my apps properly when I upgeaded my computer.)
It would be greate if someone from Adobe could reset my SN. I do not know who ask in the support line, they told me that I must seek help in the chat...
TNX.
Michal
To the link below, click on the still need help? the option in the blue box below and choose the option to chat...
Serial number and activation support (non - CC) chat
http://helpx.Adobe.com/x-productkb/global/Service1.html ( http://adobe.ly/1aYjbSC )
Maybe you are looking for
-
Hey, today I tried to import a few photos from my iPhone 6 (iOS 9.2) for my mbp (OS X 10.11.2).) When I have connected the device 2, via cable and opened Photos the photos I did today look like in tie (the previous photos were ok). And after a while
-
Iconia B1-720: will not update to OTA!
Today, I got the update notice for my Tablet and it errors after restarting and tells me that the update failed! Any suggestions?
-
my laptop does not open my SG card, and he has done it before, what happens?
SanDisk card. Laptop is vista windows 7, I think He opened a few days ago, and the photos are visible on the camera, but all suddenly not on the laptop. It says file not found.
-
Allowing APs clustering with an AP541N?
I have an AP541N and need to extend the network wireless with a second wireless access point. Can AP what models I use with the AP541N to achieve a 'cluster', please? Is it just with a second AP541N or can I use other Cisco access points to reach th
-
RV082 and Windows 7, no internet connection with active firewall
Hello I have a 1.3.98 - tm firmware RV082 and have recently upgraded several Machines to glass & RC for testing, but they can't access the internet. They can access all the other mahcines internal, but cannot ping the router. The first Pc I upgraded