Getting at Assets

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)

p​u​b​l​i​c​ ​c​l​a​s​s​ ​B​e​a​t​B​o​x​ ​{​
 ​ ​p​r​i​v​a​t​e​ ​s​t​a​t​i​c​ ​f​i​n​a​l​ ​S​t​r​i​n​g​ ​T​A​G​ ​=​ ​"​B​e​a​t​B​o​x​"​;​

 ​ ​p​r​i​v​a​t​e​ ​s​t​a​t​i​c​ ​f​i​n​a​l​ ​S​t​r​i​n​g​ ​S​O​U​N​D​S​_​F​O​L​D​E​R​ ​=​ ​"​s​a​m​p​l​e​_​s​o​u​n​d​s​"​;​
}​

Assets are accessed using the AssetManager ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.