Code example for SoundPool

Methods: setOnLoadCompleteListener

0
		// Set the hardware buttons to control the music 
		activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
		// Load the sound 
		loadedIds=new HashMap<Integer,Boolean>();
		//soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0); 
		soundPool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0);
		soundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() {
			@Override 
			public void onLoadComplete(SoundPool soundPool, int sampleId,
					int status) {
				loadedIds.put(sampleId, Boolean.TRUE);
				Log.d(TAG, "loaded sound file "+sampleId+": status: "+status);
			} 
		});		 
	} 
	 
	/** 
	 * load a music resource 
	 * @param resourceName 
	 * @return 
	 */