Answer the question
In order to leave comments, you need to log in
Resources$NotFoundException: Resource ID #0x0. What could be wrong in the code?
public void startMicro(View view) {
if (whatButton == 10) {
isSpeechOn = false;
whatButton = 0;
MainButton.setImageResource(R.drawable.mainmicro);
isrunning = false;
recognizer.finishRecording();
} else {
if (whatButton == 1) {
seconds = 0;
seconds = 0;
myseconds = 0;
if (view.getId() == R.id.mainbtn) {
TextView result = (TextView) findViewById(R.id.resultText);
MainButton.setImageResource(R.drawable.stop);
startRec();
}
}
}
}
@TargetApi(Build.VERSION_CODES.M)
public void startRec() {
final Context context = getApplicationContext();
if (context == null) {
return;
}
if (ContextCompat.checkSelfPermission(context, RECORD_AUDIO) != PERMISSION_GRANTED) {
requestPermissions(new String[]{RECORD_AUDIO}, 1);
} else {
resetRecognizer();
recognizer = Recognizer.create(Recognizer.Language.RUSSIAN, Recognizer.Model.NOTES, reclistener, true);
recognizer.start();
}
}
at com.govorillo.youtube.govorilka.MainActivity.startRec(MainActivity.java:218)
at com.govorillo.youtube.govorilka.MainActivity.startMicro(MainActivity.java:195)
Answer the question
In order to leave comments, you need to log in
In fact, when building an application, R.class is generated. I had such a problem, first of all I recommend checking whether you have all the sizes of the required images (mdpi-drawable, hdpi-drawable, xhdpi-drawable, etc.), and how suggested by coden55 to do a Project Rebuild. R.class will be regenerated and the error should be gone. Before rolling out to production, I recommend doing a rebuild every time.
Faced such an error with typos like textView.setText(0)
. Or textView.setText(x)
, and x
could be equal to 0. Perhaps you have something like this in your code
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question