所以我正在尝试编写一个关于我和我朋友的声音的音板,但是这个糟糕的事情不会认出R.raw.blahblahblah并且一直说原始的无法解决。以下是重要的代码:
package com.example.paksoundboard;
import com.example.paksoundboard.R;
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
public class SoundBoard extends Activity {
public int guyt = Selection.whichMan();
private MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_sound_board);
}
public void John(View view){
guyt = 1;
}
public void Ettore(View view){
guyt = 2;
}
public void Phil(View view){
guyt = 3;
}
public void Knox(View view){
guyt = 4;
}
public void TJ(View view){
guyt = 5;
}
public void yo(View view){
mp.reset();
switch (guyt) {
case 1: mp = MediaPlayer.create(getApplicationContext(), com.example.paksoundboard.R.j.yo);
break;
case 2: mp = MediaPlayer.create(getApplicationContext(), R.e.yo);
break;
case 3: mp = MediaPlayer.create(getApplicationContext(), com.example.paksoundboard.R.raw.t.yo);
break;
case 4: mp = MediaPlayer.create(getApplicationContext(), R.k.yo);
break;
case 5: mp = MediaPlayer.create(getApplicationContext(), R.raw.t.yo);
break;
}
mp.prepare();
mp.start();
}
非常感谢任何和所有帮助!!
答案 0 :(得分:1)
通过单击PROJECT-> CLEAN清除你的项目从Eclipse中清除...确保在清理时你不会有任何编译错误,否则你的R文件将被删除。只需注释错误行和取消注释清洁后他们 并删除此导入 import com.example.paksoundboard.R; 并且不要在原始
中创建子文件夹