【Android初学第80天】一卷旌收千骑虏,万全身出百重围。这篇文章主要讲述Android初学第80天相关的知识,希望能为你提供帮助。
android初学第80天20_MVVM
代码
BeatBox
BeatBox.java
package com.bignerdranch.android.beatbox;
import android.content.Context;
import android.content.res.AssetManager;
import android.util.Log;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class BeatBox {
private static final String TAG = "BeatBox";
private static final String SOUNDS_FOLDER = "sample_sounds";
private AssetManager mAssets;
private List<
Sound>
mSounds = new ArrayList<
>
();
public BeatBox(Context context) {
mAssets = context.getAssets();
loadSounds();
}private void loadSounds() {
String[] soundNames;
try {
soundNames = mAssets.list(SOUNDS_FOLDER);
Log.i(TAG, "Found " + soundNames.length + " sounds");
} catch (IOException ioe) {
Log.e(TAG, "Could not list assets", ioe);
return;
}for (String filename : soundNames) {
String assetPath = SOUNDS_FOLDER + "/" + filename;
Sound sound = new Sound(assetPath);
mSounds.add(sound);
}
}public List<
Sound>
getSounds() {
return mSounds;
}
}
推荐阅读
- Android初学第82天
- Android初学第81天
- Android初学第73天
- Android xUtils3使用 - 获取网络图片
- DAPP超详细解释
- 1. SpringBoot启动后,报异常:This application has no explicit mapping for /error, so you are seeing this as
- Ubuntu(64位)编译Android源码常见错误解决办法
- kali之Nmap (Network Mapper(网络映射器)
- android -------- 混淆打包报错(warning - InnerClass annotations are missing corresponding EnclosingMember a