Errors in GeoQuiz - mTrueButton and mFalseButton


I get errors on the following four lines (these are just excerpts from the actual code after these four lines):

    mTrueButton = (Button)findViewByID(;
    mFalseButton = (Button)findViewByID(;

Here is my code:


import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class QuizActivity extends Activity {

private Button mTrueButton;
private Button mFalseButton;

public void onCreate(Bundle savedInstanceState) {
    mTrueButton = (Button)findViewByID(;
    mTrueButton.setOnClickListener(new View.OnClickListener(){
    	public void onClick(View v){
    mFalseButton = (Button)findViewByID(;
    mFalseButton.setOnClickListener(new View.OnClickListener(){
    	public void onClick(View v){
    				Toast.LENGTH_SHORT).show();        	}


public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(, menu);
    return true;



Those four lines are making reference to values in so have you checked to make sure that true_button and the others are defined in


No, but I don’t know how to do that. is auto-generated, so… I’m not sure. Would you please tell me?


Do you have android:id="@+id/true_button" in your activity_quiz.xml? Especially check for the plus sign.


I do, and likewise for false_button. Here is the activity_quiz.xml file:

    android:text="@string/question_text" />

    android:orientation="horizontal" >
    android:text="@string/true_button" />

    android:text="@string/false_button" />



Do any of these ideas help?


How do I “fix project properties” as they mention on that website?



In your code, findViewByID should be findViewById. Please take note of the capitalization. Java is case sensitive language.


I did change findViewById. I cleaned the project a few times and got more errors at setContentView(R.layout.activity_quiz); [line 19]
and for the two toasts. I assume this means that there are still problems generating R correctly, which I am working on.

I am also getting this error message:
[2014-03-25 15:09:33 - GeoQuiz] C:\Android\GeoQuiz\res\menu\quiz.xml:3: error: Error: No resource found that matches the given name (at ‘title’ with value ‘@string/action_settings’).

I don’t know why it expects ‘quiz.xml’ to exist.


It expects quiz.xml to exist because of this line in

In my version of it refers to instead and main.xml exists in my project.


One poster suggested deleting R and that it would automatically regenerate, but I must admit I have looked for R. and don’t know its location.


It’s in the gen folder.


Maybe I’m missing the really obvious stuff here, but now I’m blocked by the command ‘select java compiler’, listed below. R. is still not in my Gen folder. Maybe I’m missing mmy head right now, but again, I’m blocked.

Right-click on the project name in the package explorer.

Select Java Compiler.

Check off enable project specific settings.

Select Compiler compliance level 1.6

Apply/OK. … 77#9732077


Honestly, if I were in your shoes, I’d start over. Reinstall ADT if you have to and then download the code from the book and make sure you can build it. Once you get to that point successfully, then you can start working on your own modifications again.


Thank you. What a weird scenario.


I had the same problem. It wasted one whole day to figure out what was wrong.

My symptom was the same: was not updated. I followed everything what this book asked. I also search this forum and googled it. I did “clean -> project” and “fix the project properties”. Nothing worked. I created and deleted GeoQuiz project at least 10 times. Never worked.

How did I solve?
It was simple. I deleted ADK folder, and re-downloaded and re-installed ADK. Then? It started to work at the first trial!! What the… :cry:
Anyway, if someone has the same error, delete your Eclipse & ADK directory, re-download it and re-install it. Don’t waste your day like me. :sunglasses: