Code example for AssetFileDescriptor

Methods: getFileDescriptorgetLengthgetStartOffset

0
 
public class AndroidAudio implements Audio{ 
 
	protected AssetManager assets;
	protected SoundPool soundPool;
	public AndroidAudio(Activity activity){
		activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
		this.assets = activity.getAssets();
		this.soundPool = new SoundPool(20, AudioManager.STREAM_MUSIC, 0);
	} 
	public Music newMusic(String fileName) {
		try{ 
			AssetFileDescriptor assetDescriptor = assets.openFd(fileName);
			return new AndroidMusic(assetDescriptor);
		}catch(IOException e){
			throw new RuntimeException("Could not load music " + fileName);
		} 
	} 
	public Sound newSound(String fileName) {
		try{ 
Connect your IDE to all the code out there  Get Codota for Java