Code example for Vector

Methods: add, clear, isEmpty, remove

0
     * play the sound loaded to the SoundPool by the key we set 
     * @param key  the key in the map 
     */ 
    public void playSound(String key) {
        stopSound(); 
        mSoundQueue.add(key);
        playNextSound(); 
    } 
    
	/** 
	 * play the sounds have loaded in SoundPool 
	 * @param keys the files key stored in the map 
	 * @throws InterruptedException 
	 */ 
    public void playSeqSounds(String keys[]) {
    	//stopSound(); 
    	for(String key : keys) {
    		mSoundQueue.add(key);
    	} 
    	if (!mPlaying)
    		playNextSound(); 
    } 
 
    /** 
     * Stop the current sound 
     */ 
    public void stopSound() { 
    	mHandler.removeCallbacks(mPlayNext);
    	mSoundQueue.clear();
        mSoundPool.stop(curStreamId);
        mPlaying = false;
    } 
 
    public void unloadAll() { 
    	stopSound(); 
        if (mSoundPoolMap.size() > 0) {
            for (String key : mSoundPoolMap.keySet()) {
                mSoundPool.unload(mSoundPoolMap.get(key).id);
            } 
        } 
        mSoundPoolMap.clear();   	
    } 
     
    /** 
     * Deallocates the resources and Instance of SoundManager 
     */ 
    public void cleanup() { 
    	unloadAll(); 
        mSoundPool.release();
        mSoundPool = null;
        _instance = null;
    } 
 
    private void playNextSound() { 
    	if (mSoundQueue.isEmpty() != true) {
	    	String key = mSoundQueue.remove(0);
	    	Sound sound = mSoundPoolMap.get(key);
	    	if (sound != null) {
		        float streamVolume = 0.0f;
		        streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
		        streamVolume /= mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);