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 trial

Android

Michael Foster
Michael Foster
7,801 Points

In need of help with, Getting Text from an Edit Text within the android course.

I can not figure out why I am receiving errors when trying to follow along within the Build an Interactive Story app. Stuck!!! Please help!

Michael Foster
Michael Foster
7,801 Points

package com.michaelfoster.interactivestory;

import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText;

public class MainActivity extends Activity {

private EditText mNameField;
private Button mStartButton;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mNameField = (EditText)findViewById(R.id.nameEditText);
    mStartButton = (Button)findViewById(R.id.startButton);

    mStartButton.setOnClickListener(new View.OnClickListner()
}

}

//nameEditText and startbutton is the color red and both error messages say cannot resolve symbol

2 Answers

Enrique Munguía
Enrique Munguía
14,311 Points

Make sure your xml layout file contains the EditText and Button with the id attribute spelled exactly as in your Java code.

Michael Foster
Michael Foster
7,801 Points

Thanks for such a quick response, I was able to figure out the problem by looking at other forums with similar issues. Thanks again!!!

Michael Foster
Michael Foster
7,801 Points

I fixed it thanks, I just used autocomplete instead of typing it out and now the errors are gone!