July 2015
Beginner to intermediate
600 pages
18h 59m
English
BeatBox will end up doing a lot of work related to asset management: finding assets, keeping track of them, and eventually playing them as sounds.
To manage all this, create a new class called BeatBox in com.bignerdranch.android.beatbox.
Go ahead and add a couple of constants: one for logging and one to remember which folder you saved your wrestling grunts in.
Listing 18.8 New BeatBox class (BeatBox.java)
public class BeatBox {
private static final String TAG = "BeatBox";
private static final String SOUNDS_FOLDER = "sample_sounds";
}
Assets are accessed using the AssetManager class. You can get an AssetManager from any Context. Since BeatBox will need one, give it a constructor that takes in a Context
Read now
Unlock full access