Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTerence Evans
1,870 PointsBuild an Interactive Story
In the 1st Challenge Task 1 of 1, I have:
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button;
public class MainActivity extends Activity {
protected Button mExterminateButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ExterminateButton = (Button)findViewById(R.id.exterminateButton);
// Declare our view variables
}
}
And when I put it through the compiler I get the message:
./MainActivity.java:14: error: cannot find symbol mExterminateButton = (Button)findViewById(R.id.exterminateButton); ^ symbol: variable exterminateButton location: class id 1 error
Any help would be appreciated.
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
protected Button ExterminateButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ExterminateButton = (Button)findViewById(R.id.exterminateButton);
// Declare our view variables
}
}
1 Answer
Seth Kroger
56,413 PointsThe challenge states the button's id is 'button1' and not 'exterminateButton'. (Also, style-wise, you should have the first letter of a variable name be lowercase if it's not all caps.)
Terence Evans
1,870 PointsTerence Evans
1,870 PointsThanks for the quick response Seth. I went on Google and did a search and found what I was after. Sorry to bother you.