problem when getting the value of the persistent object

Hello

I am trying to store the State of registration of the user in my App I have used persistent store. But I don't get the bak of the store database. I wrote the code below:

package com.saiservices.util;

import java.util.Enumeration;

import com.saiservices.ui.Logger;

import net.rim.device.api.system.PersistentObject;
import net.rim.device.api.system.PersistentStore;
import net.rim.device.api.util.Persistable;

public class SaiPersistentStore implements Persistable{

    private SaiHashTable mElements = null;
    static SaiPersistentStore instance;
    private static final long KEY = xxxxxxxxxxxx;
    private PersistentObject persistentObject = null;

    /**
     * Gets the single instance of DataBase.
     *
     * @return single instance of DataBase
     */
    public static SaiPersistentStore getInstance() {
        try {
            if (instance == null) {
                instance = new SaiPersistentStore();
            }
        } catch (Exception e) {
            instance = null;
        }
        return instance;
    }

    private SaiPersistentStore()
    {
         Logger.out("PersistentStoreInfo", "inside constructor  ");
        persistentObject = PersistentStore.getPersistentObject(KEY);
         synchronized (persistentObject)
           {
               if (persistentObject.getContents() == null)
               {
                   persistentObject.setContents(new SaiHashTable());
                   persistentObject.commit();
               }
           }

         mElements = (SaiHashTable)persistentObject.getContents();
         if (mElements == null){
             Logger.out("PersistentStoreInfo", "************"+(mElements == null));
             mElements = new SaiHashTable();
         }
    }

    public String getElement(String key)
    {
        Logger.out("PersistentStoreInfo", "getElement :"+key);
        Logger.out("PersistentStoreInfo", "getElement value   :"+mElements.get(key));

        return (String) mElements.get(key);
    }

    public void setElement(String key, String value)
    {
        Logger.out("PersistentStoreInfo", "setElement11111 :"+key + "   "+value);
        mElements.put(key, value);
        persistentObject.setContents(mElements);
        Logger.out("PersistentStoreInfo", "setElement22222 :"+key+"   "+value);
        persistentObject.commit();
    }

    public Enumeration getAllKeys()
    {
        return mElements.keys();
    }

}

And here's the code for hash table:

package com.saiservices.util;

import java.util.Hashtable;

import net.rim.device.api.util.Persistable;

public class SaiHashTable extends Hashtable implements Persistable{

    public SaiHashTable(){
        super();
    }
    public SaiHashTable(int initialCepacity){
        super(initialCepacity);
    }

}

Now, I'll put the element as follows:

SaiPersistentStore.getInstance (.setElement("Registration","on"));

But when I try to get the item in a way theis, gettting null value:

SaiPersistentStore.getInstance () .getElement ("Register")

Where I am doing wrong here?

The fixed. Key hash table was different. Change it and it works...

Tags: BlackBerry Developers

Similar Questions

  • Problem when resizing the round objects

    Hello

    I have a problem with the downward revision round objects.

    In summary, here's the question:

    round_corner_problem.jpg

    As you can see when I reduce a cirle of size size B, upper side and left of the circle B are flat.

    Why this happens and how to avoid it? It is really frustraiting when working with small objects.

    See you soon.

    Howdy.

    The flats on the small circles is caused by anti-aliasing misalignment with the pixel grid when the circle is resized. You will most often see when resizing a shape with an odd number of pixels. You have one see below the center of the circle is forced off the pixel grid, and anti-aliasing is disabled.

    This is the actual size.

    What should do?

    Before you accept the processing, move the circle to the center point of the circle is on the pixel grid. Use the arrow key to move around. Experiment. Move the center of the circle at different outside the premises of the grid before accepting the transformation. You will see all kinds of permutations of anti-aliasing. Choose one that is symmetrical. The focus should be on the grid. Then smoothing should be symmetrical. When the transform is applied, anti-aliasing is cooked in, and you can move back the circle to its original position if you wish.

    Like Paulo and Noel have noted, the quality of the original circle antialiasing will notice when it is reduced to the size of the web icons. Any asymmetry in the original may be noticeable to a normal size, because it is only about one or two rows of pixels on the perimeter of the circle. A small percentage of assymetry on a circle of 300px. When the circle is reduced to 10 pixels, the asymmetry affects another one or two lines of pixels. And the circle goes PEAR because the assymmetry could be as much as 10%. My guess is that the OP is working with images that are a little unhinged to start.

    There is much more to this, but it might help.

    Peace,

    Lee

  • Printing problems - I get the sizes of evil when I print from LR 5.5. on my Epson 3880 printer. USB connection. Reinstalled printer driver - not. Want to obey my print settings. What can be wrong?

    Printing problems - I get the sizes of evil when I print from LR 5.5. on my Epson 3880 printer. USB connection. Reinstalled printer driver - not. Want to obey my print settings. What can be wrong?

    I am not familiar with these communities - not provide Adobe and LR all direct support?

    You bet it's your page layout. As I said, the Epson driver has many offers for the same size paper. In addition, do NOT use Auto expand in this selection.

  • Installation of the Photoshot 13 elements. error message: "this is a problem when extracting the files. Check the amount of space available on your computer and the rights to write to the destination folder. I have 1.38 TB of free space and total control

    I try to install photoshop elements 13, that I bought and downloaded from Amazon. When I try to install it I get the following error message: "this is a problem when extracting the files. Check the amount of space available on your computer and the rights to write to the destination folder. I administrar 1.38 TB of free space and total control.

    Charles please do not remove the installation files in the Program Files directory.  I recommend to extract the installation to your downloads folder or your desktop files.  Once installation files are extracted, you can then run the installation program to install Photoshop elements 13.

  • Windows media player has encountered a problem when downloading the file. for additional assistance, click web help.

    Original title: unable to audio stream.

    Unable to audio stream, "windows media player has encountered a problem when downloading the file.  for further assistance, click web help' web help does not work, clicking web help does nothing (no response from program... a lot of negative response from me) stuck with the big pass... vista 64 bit... a lemon from the getgo... problem after problem...

    Hi Joseph,

    What is the file format of the file you are trying to download?

    This problem normally occurs when the Media player could not play the file downloaded or not supported.

    Method 1:

    Step 1: Here is the list of the formats supported by Windows Media player file:

    Information on the types of media files that supports Windows Media Player:

    http://support.Microsoft.com/kb/316992

    Note: See if the file format is in this list, if it is not there, you may need a third-party codec that can read the file.

    Step 2: For more information about codecs, see article given:

    Codecs: Frequently asked questions:

    http://Windows.Microsoft.com/en-us/Windows-Vista/codecs-frequently-asked-questions

    Warning: using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    Method 2:

    I also suggest you to run the Windows media player Fixit:

    Solve the problems of Windows Media Player video and other media or library

    http://support.Microsoft.com/mats/windows_media_player_diagnostic

    Hope this information helps.

  • "Windows Media Player has encountered a problem when burning the file to disk"?

    "I ENCOUNTERD CE WHEN BURNING YEAR MP3 AUDIO CD AND NOW I wanted TO KNOW WHY IT WON'T WORK THAT IS THE CODE POPPING up" Windows Media Player has encountered a problem when burning the file to disk ' WHAT CAN BE THE PROBLEM

    Hello MactabardX,

    I try and remove Windows Media Player and then reinstall it.
    Uninstalling and reinstalling Windows Media Player:
    Step 1.
    Uninstalling Windows Media Player:
    1. go to start and in the search type "Turn Windows willing or not.
    2. click on "Turn Windows features on or off".
    3. search for multimedia and uncheck the brand in the face of Windows Media Player.
    4 restart the computer
     
    Step 2.
    Reinstall Windows Media Player:
    1. go to start and in the search type "Turn Windows willing or not.
    2. click on "Turn Windows features on or off".
    3. find the multimedia functions and place a check mark in front of the Windows Media Player.
    4 restart the computer.

    If you encounter problems with Windows Media Player, try to use the Troubleshoot utility to see if that fixes the problem.

    Open the troubleshooting Windows Media Player settings Troubleshooter by clicking the Start button, then Control Panel. In the search box, type troubleshooting, and then click Troubleshooting. Click View all, and then click the Windows Media Player settings.

    If the size of the .wmv files is too large, it can cause Windows Media Player to stop working.

    I try and remove videos from Windows Media Player library and test to see if the size of the files could be a problem.

    If please reply back and let us know if these steps helps.

    Thank you

    Marilyn
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Windows Media Player has encountered a problem when downloading the file

    Original title: Windows Media Player does not work

    What this means: Windows Media Player has encountered a problem when downloading the file? and what do I do about it?

    Johnny: What are your exact measurements that lead to the error message?

    Temporary compensation Internet filed and the Cookies Internet Explorer could help.

  • When I want to burn a CD in Windows Media Player, it shows "Windows Media Player has encountered a problem when burning the file to disk". What's wrong? How to fix?

    When I want to burn a CD in Windows Media Player, it shows "Windows Media Player has encountered a problem when burning the file to disk".    What's wrong? How to fix?

    I tried several times to remove the selection to burn and create a new a new but it keep "Windows Media Player has encountered a problem when burning the file to delivery" appears what should I do?   What problem is it?

    Hello

    1. what file format you are trying to burn?

    2. have you made changes on the computer recently?

    3. What is the security software installed on the computer?

    If it's something you downloaded, it may be copy protected by DRM, in which case you may not burn it to a CD or DVD.

    Here are a few things to try:

    1. make sure that the disc is clean.

    2. try a different brand of blank discs.

    3. stop all other programs that are running.

    4. make sure that the hard drive does not use disk compression.

    I suggest that you follow these steps and check if they help to solve the problem.

    Method 1:

    Try to use the Troubleshoot utility to see if that solves the problem.

    a. open the troubleshooting Windows Media Player settings Troubleshooter by clicking the Start button, then Control Panel.

    (b) in the search box, type "convenience store" and then click Troubleshooting.

    c. click on show all and then click the Windows Media Player settings.

    Method 2:

    Select a recording speed (write) more slow for the CD burner.

    Change settings for burning a CD or DVD in Windows Media Player

    http://Windows.Microsoft.com/en-us/Windows7/change-settings-for-burning-a-CD-or-DVD-in-Windows-Media-Player

    Method 3:

    If you have any third-party burning software, I suggest you temporarily Uninstall it and then try to burn the disc using Windows Media Player.

    Note: Reinstall the software after the trial.

    Method 4:

    Temporarily disable all programs that could activate themselves, while burning is in progress, such as screensavers or anti-virus programs.

    http://Windows.Microsoft.com/en-us/Windows7/turn-Windows-Firewall-on-or-off
    http://Windows.Microsoft.com/en-us/Windows7/disable-antivirus-software

    Note: Run the computer without antivirus software or firewall is a potential threat to the computer; Be sure to activate security software after completing the troubleshooting steps and after identifying the problem.

    I hope this helps.

  • 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...

  • How to get the remote object mode protect?

    Hi all

    I have a question for a remote object mode protect in drive x. need your help, thank you very much ~

    Background: I have a plugin running on drive x protect mode. Without a strong name, plug-in will load my DLL (manufactured by c#). Then, in this DLL, it will use

    _3rdProxy p (_3rdProxy) Activator.GetObject = (typeof (_3rdProxy), url); for a remote object of the 3rd application (made by c# also). Then I can make communication between my app plug-in and 3rd.

    But I got an error "Access denied", said. Anyone know how to get the remote object in this case? Thank you very much ~

    Since you have a reader integration key, you are advised to use our methods of support for the official Developer.

  • Get the last object below.

    I want to get the latest object(z-order) below a selected just as the 'last object below' photo menu under-> Select object.

    How can I go about it. The IZOrderSelectionSuite interface can be used to do this, if yes then how use since I have just the UIDRef of a framework.

    Jasmine

    Hi Jasmine,.

    You can use int32 zorder_index = iHierarchySpread-> GetChildIndex (iHierarchySpline) to get the index order of the spline

    and iHierarchySpread-> GetChildUID (zorder_index - 1) to get the spline immediately below, if I remember right. Otherwise, use + 1.

    Best,

    Peter

  • problem to get the value of the af:selectOneChoice component.

    Hello team,

    I want to retrieve the values of the component values & compoanats af:selectOneChoice comes from the database.

    < af:selectOneChoice value = "#{bindings." MaritalStatus.inputValue}.
    required = "#{bindings." MaritalStatus.hints.mandatory}.
    shortDesc = "#{bindings." MaritalStatus.hints.tooltip}.
    Binding = "#{backingBeanScope.backing_EnrolByIndv_Enrolment.selectOneChoice16} '"
    ID = "selectOneChoice16".
    label = "#{msg.maritalStatus}" >
    < f: selectItems value = "#{bindings." MaritalStatus.items}.
    Binding = "#{backingBeanScope.backing_EnrolByIndv_Enrolment.selectItems16} '"
    ID = "selectItems16" / >
    < / af:selectOneChoice >


    String s = selectOneChoice16.getValue (m:System.NET.SocketAddress.ToString ());
    int a1 = Integer.parseInt (s);

    System.out.println ("valueeee..." + a1);
    This gives me the index value I want the real value... How can I get the value?

    .... You're welcome Charu...

    But mark my answer as a good I'm happy ;)

    Sameh Nassar

  • 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.

  • Problem when executing the processors in the nodes with disabled local storage

    Hello world

    We test the coherence JSR107 (a.k.a. JCache) implementation of Yannis (https://github.com/yannis666/Coherence-JSR-107) and we found the following issue when you work with a local storage where distributed cache node is disabled (using - Dtangosol.coherence.distributed.localstorage = false). Yannis implementation uses several EntryProcessors for the execution of operations get() or put () in the cache. For example, the following code is used to update a value in the cache:

    / public class PutProcessor implements InvocableMap.EntryProcessor {}

    @Override
    public Object process (input InvocableMap.Entry) {}
    BEntry entry = (BinaryEntry) BinaryEntry;
    return bEntry.isPresent ()? bEntry.getBinaryValue (): null;
    }

    }

    And put operatino is taken from the following code:

    namedCache.invoke (key, CPU)

    where processor argument contains a reference to the PutProcessor object.


    When we call JSR107 performs surgery put in the cache and code above we get following exception:

    java.lang.NullPointerException
    to com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ Storage.invoke (PartitionedCache.CDB:10)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onInvokeRequest(PartitionedCache.CDB:52)
    to com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ InvokeRequest.run (PartitionedCache.CDB:1)
    at com.tangosol.coherence.component.net.message.requestMessage.DistributedCacheKeyRequest.onReceived(DistributedCacheKeyRequest.CDB:12)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:34)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:33)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService.onNotify(PartitionedService.CDB:3)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onNotify(PartitionedCache.CDB:3)
    at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
    at java.lang.Thread.run(Thread.java:662)

    Of course we have previously started another node in the cluster with local storage enabled.

    It seems that, as no storage card is present at the node, a NullPointerException is thrown when you try to insert the entry.

    Could someone give advice on this problem and how to overcome? This implementation is based on the processor is not compatible with the knots of localstorage cache disabled?

    Thank you in advance,

    Daniel C.

    Hello

    It sounds like COH-7180 - demand deserialization failure results in a cryptic NullPointerException, that has been fixed in one of the 3.7.1 patches. The real problem is that your entryprocessor cannot be deserialized.

  • Re: Qosmio G30 - RAID of the problems when installing the OS

    I got my Qosmio G30-161 for half a year and he had thought should be time to reinstall everything, so I could get rid of things I didn't need (programs, viruses and uninteresting video clips).

    So I took my XP MCE Cd and tried to install, and I am guided me through and come to the place where I had to choose between unknown 1st and 2nd 3rd stripping mirrored. I chose the stripping as I wanted my drives to be in one. Then when I pressed "next" it gave me the error message "1005 - HDD is not ready?

    I tried to go into the BIOS and change the setting of different parameters of Toshiba told me to, but he also warned that if I changed my OS settings will need to be reinstalled. No problem. But I still get the same message error "disk is not ready?". So now, I have to use a computer other than mine to check the forums and mail etc.

    Anyone know what I need to do? I'll be happy with anything as long as I can have both my hard drives (60 + 60 GB) and OS work. :)

    Please help, I would urge for her, because the computer is the one I use for my school work. Feel free to ask questions about the tricks of the system. If you have an answer, please let it be simple, because I really don't want to mess up again ^_^

    Please check the details relating to the installation of RAID user's Guide.
    Usually if you use the clean Windows XP disk then you need to include the RAID drivers first.
    Without pre-installed RAID drivers HARD drive will not be recognized and you will not be able to install the OS!

Maybe you are looking for