July 2015
Beginner to intermediate
600 pages
18h 59m
English
Now that you have your asset filenames, you should present them to the user. Eventually, you will want the files to be played, so it makes sense to have an object responsible for keeping track of the filename, the name the user should see, and any other information related to that sound.
Create a Sound class to hold all of this. (Remember to let Android Studio generate your getters.)
Listing 18.12 Create Sound object (Sound.java)
public class Sound {
private String mAssetPath;
private String mName;
public Sound(String assetPath) {
mAssetPath = assetPath;
String[] components = assetPath.split("/");
String filename = components[components.length - 1];
mName = filename.replace(".wav", "");
}
public String ...Read now
Unlock full access