简体   繁体   中英

BlackBerry - Volume saving issue

I am facing problem to store volume level on persistence memory. I am using following code:

int _currentVolume = 50;

Code for setting player volume level:

volumeControl = (VolumeControl) _player.getControl("VolumeControl");
volumeControl.setLevel(_currentVolume);
setVolume(_currentVolume);

Code for storing volume:

public void Save() {
    StoreInfo info = new StoreInfo();
    info.setElement(StoreInfo.VOL2, String.valueOf(volumeControl.getLevel()));

    _data.addElement(info); 
    synchronized (store) { 
        store.setContents(_data); 
        store.commit(); 
    }
}

public void Get() { 
    synchronized (store) { 
        _data = (Vector) store.getContents(); 

        if (!_data.isEmpty()) { 
            StoreInfo info = (StoreInfo) _data.lastElement();   
        }   
    } 
}

But the code is not working :(. Need some help on this issue.

我看不到将Integer.parseInt((String)StoreInfo.getElement(StoreInfo.VOL2))应用于_currentVolume

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM