목록보기 항목 클릭을 기반으로 mp3 파일을 재생하고 싶지만 내 코드를 기반으로 내 앱을 실행하면이 창이 나타나고 오디오 옵션이 없기 때문에 어떤 것을 선택해야할지 모르겠습니다. 내 .mp3 파일을 연결하기 위해.
mainList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
//When clicked, go to specific activity
if (position == 0) {
if(mp.isPlaying())
{
mp.stop();
mp.reset();
}
try {
AssetFileDescriptor afd = getAssets().openFd("chimes.mp3");
mp.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength());
mp.prepare();
mp.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
호스트 컴퓨터에서 파일을 여는 데만 사용되며 장치와는 아무 관련이 없습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다