안드로이드 개발 질문/답변
(글 수 45,052)
LayoutInflater로 생성한 view로 만든 coustomlistview 종료시에 mediaplayer종료가 안됩니다.
LinearLayout안에
public class Part1ListView extends LinearLayout{
private ImageButton img_sound;
private ImageView img_picture;
// audio 저장 및 출력
private String str_audio = null, str_Url = null;
private MediaPlayer media_sound;
public Part1ListView(Context context, Part1ListItem item) {
super(context);
// TODO Auto-generated constructor stub
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.part1view, this, true);
// 각 객체 초기화
str_audio = item.getUrl();
img_sound = (ImageButton) findViewById(R.id.img_sound);
// img_sound버튼 클릭시 sound 출력
img_sound.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.i("test", str_audio);
if (str_audio != null) {
// swf가 아닌 확장자 .mp3로 변환하여 playaudio실행
str_Url = str_audio.substring(0, str_audio.length() - 4);
try {
playAudio(str_Url + ".mp3");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});
}
플레이는 되는데 종료가 안됩니다.
종료를 어디서 해야될까요? ㅠㅠ
System.eixt(0)말고는 다른 방법이 안떠오르더라구요.
많은 도움 부탁드립니다.



