0
我寫了我的代碼編譯乾淨和罰款,並說沒有錯誤。我在市面上發佈的其他應用程序中使用了相同的代碼。我更新ADT時出現問題。我閱讀了關於逐步清理的帖子,獲取最新的更新,沒有任何工作適用於我的應用。它不會播放原始文件中的聲音。它的行爲就像他們不是原始文件夾。它編譯沒有問題,但不播放MP3。任何幫助,將不勝感激。從原始文件夾中播放mp3文件的問題
我寫了我的代碼編譯乾淨和罰款,並說沒有錯誤。我在市面上發佈的其他應用程序中使用了相同的代碼。我更新ADT時出現問題。我閱讀了關於逐步清理的帖子,獲取最新的更新,沒有任何工作適用於我的應用。它不會播放原始文件中的聲音。它的行爲就像他們不是原始文件夾。它編譯沒有問題,但不播放MP3。任何幫助,將不勝感激。從原始文件夾中播放mp3文件的問題
公共類UpdatecodeActivity延伸活動{
MediaPlayer mp1, mp2;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mp1 = MediaPlayer.create(this, R.raw.wait);
mp2 = MediaPlayer.create(this, R.raw.primates);
//Button coding for menu and items
Button btn1 = (Button) findViewById(R.id.btn1);
registerForContextMenu(btn1);
btn1.setOnClickListener(this);
Button btn2 = (Button) findViewById(R.id.btn2);
registerForContextMenu(btn2);
btn2.setOnClickListener(this);
}//Closing tag for OnCreate
//OnClick handler for multiple buttons
public void onClick(View v){
if (v.getId() == R.id.btn1) {
// action to perform on button 1
mp1.start();
} else if (v.getId() == R.id.btn2) {
// action to perform on button 1
mp2.start();
}//Closes Onclick Switches
}//Closes onclick
確定找到了錯誤,我沒有把onclicklistener放到應用程序中,所以我可以按下按鈕一百萬次而沒有任何東西。感謝你的logcat,我永遠不會想到它。 –
你得到與此相關的任何消息logcat中?你可以發佈你用來閱讀/播放文件的代碼嗎? – Craigy
我如何看到logcat,我剛升級到靛藍試圖解決這個問題? –
轉到'DDMS'的視角和'窗口 - >顯示視圖 - > LogCat' – Craigy