我正在写这篇文章吗? [noob]
问题描述:
private final int NUM_SOUND_FILES = 4;
private Random rnd = new Random(4);
private int mfile[] = new mfile[NUM_SOUND_FILES]; //the second mfile
//reports error everytime
mfile[0] = R.raw.sound1;
mfile[1] = R.raw.sound2;
mfile[2] = R.raw.sound3;
mfile[3] = R.raw.sound4;
int sndToPlay = rnd.nextInt(NUM_SOUND_FILES);
无论我如何编写,我都会收到语法错误。当我获得正确的语法时,它会强制关闭。下面是与所谓的“正确”的语法,但forcecloses:我正在写这篇文章吗? [noob]
private final int NUM_SOUND_FILES = 4;
private Random rnd = new Random(4);
private int mfile[] = new int[NUM_SOUND_FILES];{
mfile[0] = R.raw.sound1;
mfile[1] = R.raw.sound2;
mfile[2] = R.raw.sound3;
mfile[3] = R.raw.sound4;}
哪里是“R”,为什么不使用构造函数进行初始化? – 2010-05-12 07:52:13
你能解释一下'foreclose'是什么意思吗? – Anonymoose 2010-05-12 07:53:23
我想通过forcelose他说的android应用程序强制用户关闭,因为一个例外。抛出什么异常? @Petar:R是Android生成的类 – RoflcoptrException 2010-05-12 08:00:01