public void onClick(View v) {
if (alButtonBool.get(buttonNum) == false) {
alButtonBool.set(buttonNum, true);
if (media_player_red_filePath.get(index) == "") {
media_player_red[index] = MediaPlayer.create(
mContext, raw);
} else {
media_player_red[index] = new MediaPlayer();
try {
media_player_red[index]
.setDataSource(media_player_red_filePath
.get(index));
} catch (Exception e) {
e.printStackTrace();
}
}
media_player_red[index]
.setOnPreparedListener(mPreparedListener);
media_player_red[index].setVolume(media_player_red_Volume,
media_player_red_Volume);
try {
media_player_red[index].prepare();
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
media_player_red[index].release();
media_player_red[index] = null;
alButtonBool.set(buttonNum, false);
}
}
'Programming > Android' 카테고리의 다른 글
Opencv 안드로이드 연동 중 Resolution 설정 문제시 (0) | 2015.12.19 |
---|---|
Android Studio 1.4 and OpenCV 3.0.0 연동 (0) | 2015.12.19 |
Media Player 버튼 연계 (누르는 동안만 재생) (0) | 2015.11.16 |
MediaPlayer Source 선택 (0) | 2015.11.16 |
Android APK 추출 툴 (0) | 2014.03.07 |