Search

'토글'에 해당되는 글 1건

  1. 2015.11.16 Media Player 토글 버튼 (Toggle 시 재생)
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

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);

}

}