我的任务完成了,直到最后几个声音都运行良好。出于某种奇怪的原因,它一直强制关闭,我看了又看,不明白为什么。我带走了声音并做了其他几个步骤,但我不明白是否有大小限制或其他什么?
这是它完成的第二个程序,有什么想法吗?
MediaPlayer mp1, mp2, mp3, mp4, mp5, mp6, mp7, mp8, mp9, mp10, mp11, mp12,
mp13, mp14, mp15, mp16, mp17, mp18, mp19, mp20, mp21, mp22, mp23, mp24, mp25,
mp26, mp27, mp28;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//set up the button sound
mp1 = MediaPlayer.create(this, R.raw.backtoyou);
//button 1 coding
ImageButton Button1 = (ImageButton) findViewById (R.id.button01);
Button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
mp1.start();
}
});
//longclick creates ringtone notification
//Button1.setLongClickable(true);
//set up the button sound
mp2 = MediaPlayer.create(this, R.raw.blow);
//button 1 coding
ImageButton Button2 = (ImageButton) findViewById (R.id.button02);
Button2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
mp2.start();
}
});
//set up the button sound
mp3 = MediaPlayer.create(this, R.raw.boomstick);
//button 1 coding
ImageButton Button3 = (ImageButton) findViewById (R.id.button03);
Button3.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
mp3.start();
}
});
//set up the button sound
mp4 = MediaPlayer.create(this, R.raw.byebye);
//button 1 coding
ImageButton Button4 = (ImageButton) findViewById (R.id.button04);
Button4.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
mp4.start();
}
});
.... 等等等等。那么文件的错误在哪里,为什么它会一直强制关闭?