Several persistent object

Hi guys,.

I am a new blackberry applications developer.  I am working on an app I need to store

First of all:

username (String)

password (String)

user (String) token

Then I need to store travel information based on the user's token. Travel information contains a lot of vectors

such as:

Names of travel (Vector)

Locator (vectors) travel

....

I am able to stor channels without any problem in store it and retrieve it without any problem. I have problems storing vectors. This is my persistent class:

class StoreUserInfo implements Persistable
{
private vector _elements;
public static final int UserEmail = 0;
public static final int UserPass = 1;
public static final int UserToken = 2;
 
    Private vector _Trip_Locators; is it good?

public StoreUserInfo()
{
_elements = new Vector (3);
for (int i = 0; i)< _elements.capacity();="">
{
_elements. AddElement (new String(""));
}
        
         _Trip_Locators = new Vector();  ////
}
    
public String getElement (int id)
{
Return (String) _elements.elementAt (id);
}
    
' Public Sub setElement (int id, String value)
{
_elements.setElementAt (value, id);
}
    
    public Vector getTripLocator()
{
Vector temp = new Vector();
for (int j = 0; j)< _trip_locators.capacity();="">
{
temp.addElement (_Trip_Locators.elementAt (j));
}
Return (Vector) temp;
}
    
    
public void setTripLocator (String addValue)
{
_Trip_Locators.addElement (AddValue);
}

   
 
}

Here's how to store information:


synchronized (storeUser)
{
If (storeUser.getContents () is nothing)
{
storeUser.setContents (new Vector());
storeUser.commit ();
}
           
UserInfoData = new Vector();
UserInfoData = storeUser.getContents ((vector));
                    
StoreUserInfo info = new StoreUserInfo();
info.setElement (StoreUserInfo.UserEmail, UName);
info.setElement (StoreUserInfo.UserPass, PWord);
info.setElement (StoreUserInfo.UserToken, UserReceivedToken);
                    
UserInfoData.addElement (info);
storeUser.setContents (UserInfoData);
storeUser.commit ();

}

and here's how to get the information stored:

Synchronized (storeUserSaved)
{
If (storeUserSaved.getContents () is nothing)
{
storeUserSaved.setContents (new Vector());
storeUserSaved.commit ();
}
         
SavedData = new Vector();
SavedData = storeUserSaved.getContents ((vector));
         
         
If (!.) SavedData.isEmpty ())
{
Info StoreUserInfo = (StoreUserInfo) SavedData.lastElement ();
Political = info.getElement (StoreUserInfo.UserEmail);
pass = info.getElement (StoreUserInfo.UserPass);
sentUserToken = info.getElement (StoreUserInfo.UserToken);

These work very well. However, I want to know how to store several objects (Vector) as unique user name.

Could someone help me with this? I browsed the forum and I found similar posts, but still I can not solve this problem.

Thanks in advance guys.

Shan

You can store a vector in the store persistent as long as all classes stored in the vector to implement the persistable interface.

Can you elaborate on the problem that you are experiencing?  Is an error or an exception thrown?  If so, what is it?

Tags: BlackBerry Developers

Similar Questions

  • change the value of an object in the content of the persistent object

    Hello

    I'm triyin to make a customizable menu, saving the preferences of the user as a custom class in a hash table which is the content of my persistent object.

    the custom class "Favoritos" is like this:

    public class Favoritos implements Persistable {
          private Boolean[] misFavoritos = new Boolean[10];
    
          public Favoritos() {
            super();
        }
    
        public Boolean[] getMisFavoritos() {
            return misFavoritos;
        }
    
        public void setMisFavoritos(Boolean[] misFavoritos) {
            this.misFavoritos = misFavoritos;
        }
    }
    

    and the hash table custom:

    public class CustomHashtable extends Hashtable implements Persistable {
    
    }
    

    in my menu configuration screen, I show the options selected as Favorites, which are defined as true in Boolean Favoritos object table in the hashtable. I retrieve the values or set them all as false if they have not been registered before, like this:

    PersistentObject persistentObject = PersistentStore.getPersistentObject(KEY);
    if(persistentObject.getContents() != null){
        CustomHashtable persistentHashtable = (CustomHashtable) persistentObject.getContents();
        if(persistentHashtable.containsKey("misFavoritos")){
        misFavoritos = ((Favoritos) persistentHashtable.get("misFavoritos"));
        }
        else{
        misFavoritos = new Favoritos();
        Boolean[] f = {new Boolean(false), new Boolean(false), new Boolean(false), new Boolean(false), new Boolean(false),
                  new Boolean(false), new Boolean(false), new Boolean(false), new Boolean(false), new Boolean(false)};
        misFavoritos.setMisFavoritos(f);
        persistentHashtable.put("misFavoritos", misFavoritos);
        persistentObject.commit();
        }
    }
    

    So I give to the user the possibility to define as true certain values and Boolean table, I try to change them this way:

    misFavoritos.getMisFavoritos()[i] = new Boolean(true);
    persistentHashtable.put("misFavoritos", misFavoritos);
    persistentObject.commit();
    

    Changes are persisted as I navigate the application, I want to say, if I close the configuration screen and open another configuration screen, changes of this show, but I I close application it loosse changes made a show all the elements of the array as false. What I do wrong?

    RuntimeStore is the other location people will such things, but it is cleared to restart the device, not the app.

    If you want to have something that you have to restart the application, then keep your storage apps and turn it off when leaving.

  • Question about the persistent object

    Hello

    When I used to store data using persistent object, data also will be deleted after uninstalling the app.

    Is there any data keep possibility even if the app is uninstalled?

    Can anyone give me a suggestion on this?

    Thank you.

    Objects are deleted when no request refers to them.

    So, if you have implemented a custom persistable object, whis would explain the removal.

    Use "Vanilla" persistable objects in the store, such as Hashtable.

  • How to exclude the field of persistent object

    Hello

    Is it possible to substitute the PersistanceStore method to persist objects?

    I have a complex data structure I need to store. One of the internal classes contain no persistent field. When I'm storing the data I don't no need to store this field, but the compiler triggers error.

    ... Widget: error! : class... Persistable marked widget by interface:... Persistable is not persistent: _field field: class... Field does not implement net.rim.vm.Persistable

    Is the way to override the implementation of this class persitant and exclude the problematic areas?

    Thanks for the reply.

    I did something similar, I created a class of data for persistence and a class of execution with additional fields.

    It's not very practical, these classes are deep into a tree of complex data, but I guess that's how it should work with BlackBerry.

  • Deleting persistent objects on uninstall

    If an application defines a class that implements Persistable, all persistent objects of this class are deleted when the application is uninstalled. It is logical and it is clear from the documentation. What is not clear, is what happens if your application is still a standard container (for example, a hash table) that in turn contains a Persistable custom class instances. The container class is deleted also? I guess it must be, otherwise, it would end up by plenty of broken references.

    Yes, it will also get deleted.

    If your problem has been solved to then please mark the thread as "Accepted Solution" and congratulations - your wish

  • Doubt about the persistent object

    Hi friends,

    I've stored data object persistent after that some time, my Simulator has taken a lot of time to load the application so I run clear.bat do fast Simulator. But after I run clear.bat. The values of what I stored in the persistent object had disappeared. Someone at - he said, therefore, it is the persistent object data are parties to cause of the performer, the clear.bat or any other reason. pls clarify my doubt friends...

    Kind regards

    s.Kumaran.

    It is b'caz of clean.bat. Clean.bat will remove all applications and unnecessary files, etc...

  • Problem on persistent object.

    Hi friends,

    My Simulator take a long time to load a program I m using the jde4.5 version. If we run clear.bat then we can accelerate simulator but I store an object any on the persistent object. It is persistent any object data erase if I run clear.bat?... is there another way to save the persistent object and make our quick Simulator to load the program. M pls kindly help.

    Kind regards

    s.Kumaran.

    Yes, clean.bat also erases store persistent Simulator (it stored in the *.dmp file).

    But clean.bat takes a long time to run, because it removes all the additional files of the Simulator file system.

  • By aligning several HTML objects on a page?

    I have a page that requires several HTML objects - I have inserted the code in the object > insert HTML, but they are all out of alignment in both the preview within the Muse and preview this page in a browser, even thought that they are perfectly aligned on the creation page. I tried to group the items, but it does not work. Does anyone know how to make sure they all stay in alignment?

    Hello

    This kind of problem occurs generally if the rectangle of the object is greater than the size of the object. He pushes the adjacent object, resulting in misalignment. Please check and make sure the rectangle of the objects is not bigger than the real object.

    Kind regards

    Aish

  • Not possible to store several fileReference object to the same table?

    Hi all

    I'm trying to store several fileReference object in a table. But whenever I have a new object each time push() artefacts which is already in the table gets set on the object later.

    I let the user selecting an image. Then I push the fileReference object selected in a table like my_array.push (FileReference (event.target));

    If I then executes a loop on 'my_array' to check he's glad I get the most recent pushed fileReference for each index object in the table.

    With an object pushed:

    1 Image1.jpg

    With two objects pushed:

    1 Image2.jpg

    2 Image2.jpg

    Anyone has any ideas on this?

    Thank you very much

    Hello

    Sorry for the delay.  You've probably discovered the answer to that now, but in case you do not have or someone else runs into this issue here is the code that should fix this:

    // Local Files
    private var fileList:Array = new Array();
    private var localFiles:FileReference = null; 
    
    private function browse(event:MouseEvent):void {
         localFiles = new FileReference();
         trace("[Browse] Using local files");
         localFiles.addEventListener(Event.SELECT, onLocalFilesSelected);
         localFiles.browse();
    }
    

    The problem is you have had one instance of localFiles, and while that you stored more than once in the table, when the reference has changed it performs all of the table.  Instead, I'm newing up a FileReference browse() service, so that we get a new each time.  I hope that makes sense.

    Chris

  • The BlackBerry object Handles and the persistent object Handles?

    Can someone please what are the object Handles and handles of object persistent in Blackberry? and how are they different?

    Object handles are pointers to a Java object.  Each object that you create in your application using one of them.  Similarly, each object stored in the persistent store contains a handful.

    If you have a complex object you want to store in the persistent store, as a vector that contains a number of complex classes, you can store the vector in a group of objects that you want to save the object handles.  Grouped objects use a single Treaty when it is stored in the persistent store.  The disadvantage is to ungroup the object for editing.

    You will need to balance saving handles object against the drop in performance of separate objects.  Object groups are ideal for the complex elements that are frequently changed.

  • Persistent objects

    I know there is a problem with the definition of an object persistent in a library if two or more applications will use.

    But he is sure to have an object in a library that other applications it will be extended to an object persistent more complex?

    Which always causes an error with the persistent store?

    Sorry, I have contributed to some discussions and I do not remember that you speak...

    It was probably two applications, eager to share an object.  And the point that if they share an object, they must also share the full qualified class, which means that have to share a library containing this class.

    In any case two different GUIDS should mean that you have no problem. However, the library should be deleted, both will go.

  • How to evolve several selected objects (type) 'In Place?'

    I have reflected on the window of the scale, also "scale" dialog box that is the same dialog box "pull-down" in the main menu and tool... The selected items are resized to the size but also they are resized by location so everything shrinks its place. In Illustrator CC, several selected items can be resized "in place?

    Try the transformation of each command from the object > Transform menu.

  • Try to resize C:\ on preproduction servers that are less than 59 GB using several Where-Object checks

    Hi people

    Im trying to increase all disks C:\ of different sizes for a uniform 60 GB.

    I found a thread in this community that attempts to automate it as follows:

    Get-hard drive - vm "my VM | where {$_.} Name - eq 'disk 1'} | Together-hard drive - CapacityGB 60 - ResizeGuestPartition-confirm: $false

    To confirm, the command works but the ResizeGuestPartition does not work, so I need to automate this later.

    For now the key is to get this working and it does not appear:

    Get-VM-Tag "preproduction" | Where-Object {$_.} Guest.OSFullName - like ' * Windows Server * "- and $_. PowerState - eq 'Receptor' - and ($_.) Guest.Disks.Path - eq "C:\". "- and $_. Guest.Disks.CapacityGB - lt 59)}

    Im trying to figure out how to use a hash table / script block to tell if the disc is "C:\". "and the size of this drive is less than 59 GB, then resize the disk. Before I resize the disks, I need to validate the im servers get back are indeed correct - for the moment, they are not as I checked inspected these variables manually through PowerGUI (excellent by the way).

    Even if I'm just trying to Get-VM-Tag "preproduction" | Where-Object {$_.} Guest.Disks.Path - eq "C:\". "- and $_. Guest.Disks.CapacityGB - lt 59} the result does not work and I think that its because it detects all the disks and then said there is at least one drive which is equal to "C:\". "and at least a drive that is less"Go 59 -"but I need it to be the same disk not different disks for obvious reasons, otherwise the result will always be wrong.

    LucD im sure you meet a reading, I would really appreciate your help

    Im trying to start searching for a cleaner steamer so that I don't have to run several lines of code to achieve the same.

    Much appreciated,

    Mike

    Try like this

    Get-VM-Tag "preproduction" |

    Where-Object {$_.} Guest.OSFullName - like ' * Windows Server * '- and

    $_. PowerState - eq 'Receptor' - and

    (($_. Guest.Disks | where {$_.} Path - eq "C:\". »}). (CapacityGB-le 59)} |

    Select name

  • Error in uncheck allow several resource object in the console design

    Hello

    I need to uncheck the allow several object resource into Console design, but operation generates an error, and the change is not applied.

    IOM will be 11 GR 1 material.

    DB read: select distinct ugp.ugp_key, ugp.ugp_name, ugp.ugp_display_name of the PMU PMU, gpg gpg where ugp.ugp_key = gpg.ugp_key and (gpg.gpg_ugp_key (23))
    [2013 03-21 T 06: 24:27.516 - 07:00] [oim_server1] [NOTIFICATION] [] [XELLERATE. PERFORMANCE] [tid: [ASSETS].] [ExecuteThread: '3' for the queue: "(self-adjusting) weblogic.kernel.Default"] [username: xelsysadm] [ecid: 91039ee4d5030ad9:6a4e2a3a:13d88717e95 :-8000-0000000000005521,0] [APP: IOM #11.1.1.3.0] query: DB: LOAD 0: 0, TOTAL: 0
    [2013 03-21 T 06: 24:27.516 - 07:00] [oim_server1] [NOTIFICATION] [] [XELLERATE. DATABASE] [tid: [ASSETS].] [ExecuteThread: '3' for the queue: "(self-adjusting) weblogic.kernel.Default"] [userId: xelsysadm] [ecid: 91039ee4d5030ad9:6a4e2a3a:13d88717e95 :-8000-0000000000005521,0] [APP: #11.1.1.3.0 IOM] DB read: SELECT count (*) as count of oug WHERE obj_key = 7 and (ugp_key in (1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23)) and oug_write = '1'
    [2013 03-21 T 06: 24:27.517 - 07:00] [oim_server1] [NOTIFICATION] [] [XELLERATE. PERFORMANCE] [tid: [ASSETS].] [ExecuteThread: '3' for the queue: "(self-adjusting) weblogic.kernel.Default"] [username: xelsysadm] [ecid: 91039ee4d5030ad9:6a4e2a3a:13d88717e95 :-8000-0000000000005521,0] [APP: IOM #11.1.1.3.0] query: DB: LOAD 0: 0, TOTAL: 0
    [2013 03-21 T 06: 24:27.517 - 07:00] [oim_server1] [NOTIFICATION] [] [XELLERATE. DATABASE] [tid: [ASSETS].] [ExecuteThread: '3' for the queue: "(self-adjusting) weblogic.kernel.Default"] [userId: xelsysadm] [ecid: 91039ee4d5030ad9:6a4e2a3a:13d88717e95 :-8000-0000000000005521,0] [APP: #11.1.1.3.0 IOM] DB read: select evt.evt_key, evt.evt_name, evt.evt_package dob dob, evt evt, dvt dvt where dob.dob_key = dvt.dob_key and dvt.evt_key = evt.evt_key and (dob.dob_name = 'com.thortech.xl.dataobj.tcOBJ' or dob.dob_name = dob.dob_name = 'com.thortech.xl.dataobj.tcDataObj' or 'com.thortech.xl.dataobj.tcTableDataObj') and dvt.dvt_pre_update_sequence > 0 by dvt.dvt_pre_update_sequence order
    [2013 03-21 T 06: 24:27.518 - 07:00] [oim_server1] [NOTIFICATION] [] [XELLERATE. PERFORMANCE] [tid: [ASSETS].] [ExecuteThread: '3' for the queue: "(self-adjusting) weblogic.kernel.Default"] [userId: xelsysadm] [ecid: 91039ee4d5030ad9:6a4e2a3a:13d88717e95 :-8000-0000000000005521,0] [APP: IOM #11.1.1.3.0] query: DB: 1, LOAD: 0, TOTAL: 1
    [2013 03-21 T 06: 24:27.518 - 07:00] [oim_server1] [ERROR] [] [XELLERATE. SERVER] [tid: [ASSETS].] [ExecuteThread: '3' for the queue: "(self-adjusting) weblogic.kernel.Default"] [userId: xelsysadm] [ecid: 91039ee4d5030ad9:6a4e2a3a:13d88717e95 :-8000-0000000000005521,0] [APP: IOM #11.1.1.3.0] class/method: tcDataObj/save error: failed to update data
    [2013 03-21 T 06: 24:27.518 - 07:00] [oim_server1] [NOTIFICATION] [] [XELLERATE. DATABASE] [tid: [ASSETS].] [ExecuteThread: '3' for the queue: "(self-adjusting) weblogic.kernel.Default"] [userId: xelsysadm] [ecid: 91039ee4d5030ad9:6a4e2a3a:13d88717e95 :-8000-0000000000005521,0] [APP: #11.1.1.3.0 IOM] DB read: select err_key, err_code, err_desc, err_rowver, err_remedy, err_count, err_last_occurance, err_action, err_help_url, err_severity of err where err_code ='DOBJ. UPDATE_FAILED'
    [2013 03-21 T 06: 24:27.519 - 07:00] [oim_server1] [NOTIFICATION] [] [XELLERATE. PERFORMANCE] [tid: [ASSETS].] [ExecuteThread: '3' for the queue: "(self-adjusting) weblogic.kernel.Default"] [userId: xelsysadm] [ecid: 91039ee4d5030ad9:6a4e2a3a:13d88717e95 :-8000-0000000000005521,0] [APP: IOM #11.1.1.3.0] query: DB: 1, LOAD: 0, TOTAL: 1
    [2013 03-21 T 06: 24:27.519 - 07:00] [oim_server1] [ERROR] [] [XELLERATE. DATABASE] [tid: [ASSETS].] [ExecuteThread: '3' for the queue: "(self-adjusting) weblogic.kernel.Default"] [userId: xelsysadm] [ecid: 91039ee4d5030ad9:6a4e2a3a:13d88717e95 :-8000-0000000000005521,0] [APP: IOM #11.1.1.3.0] class/method: tcDataBase/rollbackTransaction some problems: Rollback performed [[...]
    java.lang.Exception: Rollback performed
    at com.thortech.xl.dataaccess.tcDataBase.rollbackTransaction(tcDataBase.java:578)
    at com.thortech.xl.dataobj.tcDataObj.rollback(tcDataObj.java:904)
    at com.thortech.xl.dataobj.tcDataObj.doRollback(tcDataObj.java:867)
    at com.thortech.xl.dataobj.tcDataObj.save(tcDataObj.java:538)
    at com.thortech.xl.dataobj.tcTableDataObj.save(tcTableDataObj.java:2906)

    After you apply BP06, let the Multiple Option cannot be changed from true to False [1556385.1 ID]

  • Several Audio objects in Captivate 5...

    Hello

    I want to create a series of Captivate 5 slides that contain many audio objects, these objects will play the sound associated with a point defined by mouse click, rollover or a similar event.  The blade should stay persistent until the user clicks a button that them will advance to the next slide in which a similar format will be presented.

    The creation of the progress button is a simple case, but the creation of audio objects that will play due to various user events doesn't seem so simple, and maybe it's because I'm still finding my hat of timelines of Captivate.

    I tried to create slidelets I add audio to and then tried to add the property on working capital to run the advanced measures.  I then created an expression in which I put a script to extract the current image and add value to it so that it would allow the slide to the natural pause point that has been created with the introduction of buttons.  However this led to undesirable effect of simply enable all the sound elements at the same time.  When I spread the slidelets in the time line after the break of the button, only the slidelet was available, as the other were too quirky in the timeline panel and were not visible at the time of the break.

    I was just wondering if I'm on the right track here, or if there is a simple way to do what I want to do, which is to allow students to text and rollover/click and hear audio text, or to have a button that will do it.  It might also allow students to see an issue that when you click on the answer will be spoken.

    Any help is greatly appreciated.

    Kind regards.

    Captivate 5 - Version 5.0.0.596

    On a 32-bit Windows XP system

    Hi insearchofanswers,

    No worries!  Once I was very distressed about something and got a fix here.  The very simple solution - visibility for my items.

    I wasn't sure how to create audio on a button, because I have not used this technique before, but I did a little searching around and found this excellent How - to's:

    http://iconlogic.blogs.com/weblog/2007/05/adobe_captivate_1.html#TP

    It's for Captivate 2, but I tried on Captivate 4 and it still worked.  I'm sure that it will still work with Cap5, too.  Good luck!

Maybe you are looking for