View persistent data saved on start

Hi, a BB n00by here.

I was wondering how I can display the previously saved data on the screen when the application starts.

So the user will save some information that they insert into the fields, then save and exit. When the user starts the application once, they will be displayed on the screen.

I struggled trying to understand this for 2 days now!

Help, please! Thanks in advance!

I would like to change your code as follows:

  1. Take the body of the menu item 'Get' run() method and it becomes a method of the class MusicStores (call loadData()). Replace the body of the run() method of the menu to any call loadData item.
  2. In the MusicStores constructor, call loadData() just before calling pushScreen.

I think that's all that is needed.

Tags: BlackBerry Developers

Similar Questions

  • How to store/retrieve 'Date' using persistent data?

    Hello everyone - this is my first post on the BlackBerry Support Forums. I'm trying to provide a lot of relevant information as possible, but if I miss anytihng or I did not understand by asking what I want, please let me know.

    Background:

    I use Eclipse IDE ver 3.5.0 and BlackBerry Java plug-in for Eclipse 1.1. I build my application for BlackBerry JRE 5.0.0.

    Question:

    I want to save a "Date" field for persistent data so that I can recover and display in the format of Date once again (no chain). Here's a more detailed explanation.

    My application has three fields on the main screen. They are

    'Name' - AutoTextEditField

    "Gender" - ObjectChoiceField

    "Date of birth" - DateField

    Using persistent data to store the data entered into these fields, as described in the BlackBerry tutorials (http://na.blackberry.com/developers/resources/A13_Storing_Persistent_Data_V2.pdf), I am able to save and retrieve all of these areas, but only in 'Chain' format.

    Unfortunately, this won't work for me for the following reason.

    I create the Date of birth as follows

    "dateOfBirthField = new DateField (" BirthDate: ", System.currentTimeMillis (), DateField.DATE" ");"

    This creates an interface evolved for Date of birth, where the user can select and edit fields month, Date and year separately. When the user saves the information entered and wants to retirve it again, I want to display the date recorded in the same format so that the user can change again in exactly the same way as described above. But if I save it as a string, I can't fill in the field "Date" with the "chain" recovered. That is, I can't do something like

    dateOfBirthField.setDate (info.getElement (StoreInfo.DOB));

    Where "info.getElement (StoreInfo.DOB)" is similar to what is described in the tutorial.

    I searched the web for a possible solution, but never found any. All I found to date stored as a string and recovered just to see what was saved, but not for the changes resulting.

    Someone please let me know if what I am asking is possible. If Yes, can you please suggest a way to do it?

    Thanks in advance.

    Or it can store any object extra Long, no need to create garbage in chains.

    Long I = new Long (1234556);

    long x = i.longValue)

  • Can be persistent data that is stored on PC edition

    Working on the same project and managed to save persistent data. It's fine for the restoration of the database, but I hope to be able to change the data and possibly add more data, then restore it on the device.

    Q1: I use the right method to do this?

    I followed the example in chapert 9 of the development environment Java BlackBerry version 4.1.0.

    Q2: I came across a problem.backing to the top my persistent data is only the Setup program for one of my stores. How can I configure my backup so that the two stores are backed up?

    Thank you.

    [can someone who understands why we need of Html messages and text not just explain to me why the 'tab' and BACKSPACE navigates]

    you to another page, and not only in the icongraphic world?? ]

    At a minimum, you must understand the hierararchies and is that a cast - you can try to search on the term of classcastexception

    confined to sun.com as a good starting point (they have java tutorials large and your question relates to java).

    Anyway, after navigation back here and hoping the r eidot returns after each keystroke, let me see what is on my Clipboard.

    If you take your unknown x and do something like that.

    String nm = x.getClass () .getName ();

    the name should give you an idea what you have - in all the liklihood, it isn't what you expect, but in all cases, you should

    be able to determine if (x instanceof test) is true or false.

    Situations where you cannot know a priori what you (isn't usually a good thing), you can call different trees to help

    castexceptions (although it would probably be better of instanceof tests or same string on the result of above, nm)

    almost never, you want to implement logic nothing exceptional in exception handlers, but it can be easy sometimes).

    try {mi.add (new PhluBroMenuItem (app, (String) x, idx)) ;}}
    catch (ClassCastException e)
    {try {mi.add ((MenuItem) x) ;} catch (ClassCastException f)}}
    {mi.add (new PhluBroMenuItem (app, x.toString (), idx)) ;}}
    catch SomeDumException f)
    {mi.add (new PhluBroMenuItem (app, "without string result", idx)) ;}}

  • every day computer requires me to take to remove the data screen and start Recovery

    Hi I actually had this problem for many years. I have an emachines t5052 deskop with about 1 GB of ram and a 100 GB hard drive, I got upgradedto windows vista and the computer screen would be just black when I went back to it. so I have to unplug the unit twice for deleting system restore data and screen start option making this option would start the computer for vista. recently, I did a clean install of windows 7 32 bit and was hoping id never have to deal with this again but I still have to and seems to be worst im running norton 360 and have all the updates. How can I solve this ive already tried sfc/scannow, he said all the files the integrity

    Try updating the chipset and graphics drivers. If no update is available, uninstall the drivers, reboot the PC, install the drivers, reboot the PC and then check.

    Answer if the problem persists.
  • Trasnfer blackBerry 10 data saved BlackBerry OS7 to Andriod using the switch of the device

    Is it possible to transfer data saved using switch of the device, Blackberry OS7 running on Andriod phone?

    Help, please! Thank you!

    No, the switch device app goes beyond data transfer on a device BlackBerry 10 only what it is built to help users MOVE for BlackBerry 10.

    Webcast of switch device: BlackBerry OS smartphone to smartphone BlackBerry 10

    Switch appliance Webcast: OS Android smartphone to smartphone BlackBerry 10

    Switch appliance Webcast: iOS smartphone BlackBerry 10 device

    See you soon!

  • Persistent data and uninstall an app problem.

    Hello

    I'm checking the storage of persistent data with a very silly application, but maybe I'm do sth wrong as that it does not work as I supposed it should.

    My application only checks if there is some content in the store persistent and if not, it creates. I want to check that when the application is uninstalled, these persistent info will be deleted, but as I just test, it is not.

    This is my code:

     public TestP(){
            String info = "nothing";
            synchronized(store) {
                String currentinfo = (String)store.getContents();
                if(currentinfo == null) {
                    //we create it
                    String contents = "something";
                    store.setContents(contents);
                    store.commit();
                } else {
                    //we retrieve it
                    info = currentinfo;
                }
            }
    
            MainScreen ms = new MainScreen();
            ms.add(new LabelField("Testing Persistance..."));
            ms.add(new LabelField(info));
            ms.add(new LabelField("That's all..."));
    
            pushScreen(ms);
        }
    

    And that's how I create the store

    'com.app.test.TestP' at long---> 0xcdbcc77c2e7ecf8cL
    Bank private static PersistentObject = PersistentStore.getPersistentObject (0xcdbcc77c2e7ecf8cL);

    The first time I run my application, the display will return to "nothing" and the text next time 'something '. It's ok, but when I uninstall my application, the first time also shows 'something', which according to me, that he should not be allowed.

    I do something wrong?

    How persistent store information can be removed on an uninstall of the application?

    Concerning

    Your persistent data are of type String, which is a common object of the rim.  It is not necessary for the BB to delete your data - another application can use it.

    However, if you used one of your own classes - even if it comes extends the string and does nothing else - then it will be deleted when your Application is removed, because with your driveway application, there's nothing on the device which includes that Object.

  • Problem of persistent data object

    Dear Sir.

    Hello

    I am writing a module that implements the earpiece of the phone, simply

    and I would use persistent object to store information

    But I am facing the following problems:

    When I use the persistent objects, the Simulator to show that there is no instance of the application,

    as my program doesn't include any GUI,

    would my recognized program just as a Moudle and the persistent object should point the data store with an application?

    Thank you very much

    Please see the following for more information.

    http://supportforums.BlackBerry.com/T5/Java-development/persistent-data-and-uninstalling-an-app-issu...

    http://supportforums.BlackBerry.com/T5/testing-and-deployment/handle-stored-data-when-removing-an-AP...

    http://supportforums.BlackBerry.com/T5/Java-development/persistent-data-and-uninstalling-an-app-issu...

  • Force the persistent data that is not retained on App upgrade

    Hello

    I'm developing a new version of an existing application. The earlier version of the data stored in the persistent store of the device. When a user installs the new version of the application, they get a prompt saying something like "the persistent data is stored on the device. You want to keep these data? ».

    If the user answers Yes, the application will continue to use the old data which has been made persistent by the initial version of the application. This isn't what I need to happen.

    If the user answers no, the app will wipe the old dat and rebuild the store persistent with my current data. It is the course of action I want to request each time.

    Since there is no way to guarantee that each user will select 'NO' to this prompt, is it possible to configure the new version so that the data is not retained automatically?

    What other options are there for dealing with this situation?

    Thank you

    The f

    If the application can access the old data, why not just remove them when the application runs? In order to distinguish, again, you can design new data to contain a signature value that is not present in the old data. (For example, you can set your local record store to have record 1 always contain version store data, in a format that is not likely to be present in earlier formats.)

    An upgrade does not (usually) follow the same procedure with regard to the persistent data as a sequence of uninstall/install. However, there are occasional messages here on updates apparently lose persisted data that was supposed to be preserved. I did not understand everything exactly what are the causes which, but it has not considered the norm.

    P.S. If you use RecordStore instead of Persistable, custom classes are not relevant. The record store is deleted when all the MIDlets in the MIDlet suite, who created the store folder is uninstalled.

  • ClassCastException JVM error 104 on A14 storing downloaded persisted data example

    Hello world

    I've been running examples of demonstration programs using Eclipse. I'm ok with A10 write your first application and UI A11, but on trying to run A13 storing persistent data, I get FMV 104 Eception ClassCastException error.

    The code is exaclty as in the downloaded example, so I can't imagine what the problem is.

    Someone else had a similar problem please.

    Thanks a lot for your help

    Roy

    I have actually used this particular article, but I didn't need to compile. Once I realized the syntax is relatively simple, in my humble opinion.

    Good luck with the rest of your development,

    ~ Dom

  • I need a few persistent data store help of Pentecost

    Hi, I have a problem, try to store persistent data, I m using Eclipse 3.4.2 and BlackBerry plugin, as I check my work with the correct laboratory and my code hasn´t issues only a warning I see on the laboratory code it s normal, but when I try to run the Simulator I get this:

    "Eception exception: lack of measurement of the resource.

    and this is the code

    package com.rim.someguy;
    
    //Import section
    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 net.rim.device.api.i18n.ResourceBundle;
    import java.util.*;
    
    public class measure extends UiApplication implements measureResource{
    
        //Variables for user interface fields
        private EditField numMeasureDev;
        private AutoTextEditField observation;
        private EditField lecture;
        private ObjectChoiceField choice;
        private EditField date;
    
        //Persistent data
        private static Vector data;
        private static PersistentObject store;
    
        //Resource bundle variable
        private static ResourceBundle _res;
    
        //MAIN
    
        public static void main(String[] args){
            measure app = new measure();
            app.enterEventDispatcher();
        }
    
        //Save Menu
        private MenuItem saveItem = new MenuItem(_res, SAVE, 110, 10){
            public void run(){
                StoreInfo nfo = new StoreInfo();
                nfo.setElement(StoreInfo.NUM, numMeasureDev.getText());
                nfo.setElement(StoreInfo.LEC, lecture.getText());
                nfo.setElement(StoreInfo.DAT, date.getText());
                nfo.setElement(StoreInfo.SEL, _res.getString(choice.getIndex()));
                nfo.setElement(StoreInfo.OB, observation.getText());
                data.addElement(nfo);
    
                //Storing data
                synchronized(store){
                    store.setContents(data);
                    store.commit();
                }
                Dialog.inform(_res.getString(APP_SUCCESS));
                numMeasureDev.setText(null);
                lecture.setText(null);
                date.setText(null);
                choice.setLabel(null);
                observation.setText(null);
            }
        };
    
        //Get Menu
        private MenuItem getItem = new MenuItem(_res, GET, 110, 10){
    
            protected int index;
    
            public void run(){
                synchronized(store){
                    data = (Vector) store.getContents();
                    LabelField label = new LabelField();
                    label.setText("Selecciona el dato a mostrar: ");
                    BasicEditField bef = new BasicEditField();
                    index = Integer.parseInt(bef.getText());
                    if (!data.isEmpty()){
                        StoreInfo nfo = (StoreInfo) data.elementAt(index);
                        numMeasureDev.setText(nfo.getElement(StoreInfo.NUM));
                        lecture.setText(nfo.getElement(StoreInfo.LEC));
                        date.setText(nfo.getElement(StoreInfo.DAT));
                        choice.getIndex();
                        observation.setText(nfo.getElement(StoreInfo.OB));
                    }
                }
            }
        };
    
        //Persistent Object
        static{
            //Resource Bundle
            _res = ResourceBundle.getBundle("measure");
    
            //Get the reference to PersistentObject and set value to Vector if is empty
            store = PersistentStore.getPersistentObject(0xdec6a67096f833cL);
            //key is a hash
            synchronized(store){
                if (store.getContents() == null){
                    store.setContents(new Vector());
                    store.commit();
                }
            }
        }
    
        //Class created for a persistent object StoreInfo
        private final static class StoreInfo implements Persistable{
    
            //Data for elements
            private Vector elements;
    
            //Fields
            public static final int NUM = 0;
            public static final int LEC = 1;
            public static final int SEL = 2;
            public static final int OB = 3;
            public static final int DAT = 4; 
    
            //in StoreInfo, add a new empty Vector with capacity of 4 elements and persist
            public StoreInfo(){
                elements = new Vector(5);
                for(int i = 0; i < elements.capacity(); ++i){
                    elements.addElement(new String(""));
                }
            }
    
            //Retrieve Vector element
            public String getElement(int id){
                return (String) elements.elementAt(id);
            }
    
            //Set Vector Element
            public void setElement(int id, String value){
                elements.setElementAt(value, id);
            }
        }
    
        //Measure constructor declaration
        public measure(){
    
            //Create a main screen
            MainScreen mainS = new MainScreen();
            mainS.setTitle(_res.getString(APPLICATION_TITLE));
            numMeasureDev = new EditField(_res.getString(TEXT1),"",
                    Integer.MAX_VALUE, EditField.FILTER_NUMERIC);
            lecture = new AutoTextEditField(_res.getString(TEXT5),"",
                    Integer.MAX_VALUE, EditField.FILTER_NUMERIC);
            date = new EditField(_res.getString(TEXT6),"");
            choice = new ObjectChoiceField(_res.getString(TEXT2),_res.getStringArray(OPTION));
            observation = new AutoTextEditField(_res.getString(TEXT3),"");
    
            //Adding elements to Screen
            mainS.add(numMeasureDev);
            mainS.add(lecture);
            mainS.add(date);
            mainS.add(choice);
            mainS.add(observation);
    
            //Adding menuItems to menu
            mainS.addMenuItem(saveItem);
            mainS.addMenuItem(getItem);
    
            //Push all elements to screen
            pushScreen(mainS);
        }
    }
    

    If anyone knows what I m hurt you showme how please!

    Two thoughts:

    1. If you have changed somehow the object type that you want to keep, you must remove the Simulator files before running again.
    2. How about you provide a clue as to where the class cast exception that happens? You are more likely to help in this way.
  • Persistent data store must signed Key?

    I don't know if I changed another somenting, but since I've implemented persisted data, I can not run the application on my real device...

    I get: error at startup appname: Module "appname-2' attempst to access a secure API."

    I don't want to buy a key signed because I don't need...

    That's what I use:

    Net.rim.device.api.system import. *;

    ... code...

    long KEY = "APPNAME.COM".hashCode ();

    persist is PersistentStore.getPersistentObject (KEY);.

    SerialRegistrado = (String) persist.getContents ();

    If (SerialRegistrado == null) {}

    application.popScreen (this);

    new Valida (application, next);

    SerialRegistrado = new String();

    SerialRegistrado = "Epaloco";

    persist.setContents (SerialRegistrado);

    Persist.Commit ();

    }

    If it does not need a signature key, can someonel help me how to identify code that needs a key?

    I checked http://na.blackberry.com/eng/developers/javaappdev/codekeys.jsp but cannot find anything

    Help, please...

    Of PersistentStore API:
    Category: Signed: This element is accessible only by the signed applications. If you intend to use this item, please visit http://www.blackberry.com/go/codesigning for a set of keys for code signing. Code signing is required for applications running on BlackBerry smartphones. development on the BlackBerry Smartphone simulators can occur without code signing.
    Since: JDE 3.6.0

  • On the forms send us and receive in return, data in the form of fields will be not print.  We can view the data, but the fields to print Virgin.  How can I fix it?

    On the forms send us and receive in return, data in the form of fields will be not print.  We can view the data, but the fields to print Virgin.  How can I fix it?

    OK, it's different. These text boxes are (at least engineering point of view) not considered form data, they are annotations (or markup). On your print dialogue box, you will see a group of "Comments & Form". Make sure that the first control is set to "Document and annotations:

    After this change, you should see the markup of your impressions.

  • Creating folders in the view of data with powercli store

    Hello

    We try to automate some parts of a build script and we want to create a folder in the view of data warehouses to move all the local disk.  the only place that I can create a folder has been the point of view of Cluster, DataCenter and VM.  is there a way to do this?

    Thank you

    Matt

    This is a hidden folder named "datastore".

    You can do

    $dsHome = Get-Folder -Name datastoreNew-Folder -Name MyFolder -Location $dsHome
    

    Note that there is 1 folder "data store" by the data center.

    If you have more than 1 data center in your vCenter, you need to indicate what you want "datastore" folder from the data center.

    $dc = Get-Datacenter -Name DC$dsHome = Get-Folder -Name datastore -Location $dcNew-Folder -Name MyFolder -Location $dsHome
    
  • Persistent data in the copy/paste

    I have what I think it's a very simple problem I had a bit of difficulty to solve. I have a few persistent data added to kFrameListBoss that is not survive a copy and paste. Paste a picture containing my in a new document entitled results in the new framework with default values. I looked at the example of BasicPersistInterface and read by all relevant parts of the documentation for the SDK, I could find, but I don't see anything that indicates a special action that must be taken to ensure that data are copy/paste correctly.

    What might be missing?

    I doubt that kFrameListBoss.

    You can add persistent data on kDrawablePageItemBoss?

    I think that kFrameListBoss is recreated by the dough.

  • Live View Live Data View CS3 vs. CS4

    In DW CS3, I was able to edit php on Design with Live Data View mode pages. Without it the page not showed correctly. This makes life easy adding content to the clients web pages (the main pillar for the maintenance of web sites).

    With DW CS4 this feature seems to have been deleted, or maybe I can just work on how to get it.

    Add a lot of content in code view is a pain - can someone tell me so and why this changed and DW became a fancy coding tool but that the workhorse that it used to be?

    Join agn zfnst wrote:
    > In DW CS3, I was able to edit php pages in Design with Live Data View mode
    > turned on. Without it the page not showed correctly. This has made life easy
    > Adding content to the clients web pages (the main pillar for the maintenance of web sites).
    >
    > With DW CS4 this feature seems to have been deleted, or maybe I just
    > can not work on how to get it.

    To access the Live view data in CS4, select view > Live Data or use the
    shortcut keyboard, Ctrl + Shift + R / Shift + Cmd + R.

    --
    Adobe Community Expert David Powers
    Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

Maybe you are looking for