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 trialCaleb Kleveter
Treehouse Moderator 37,862 PointsError: can not find symbol class ReletiveLayout.
I am getting a warning:
error: can not find symbol class ReletiveLayout.
I thought that it might be a missing import statement, but that wasn't the problem. See my code:
package calebkleveter.funfacts;
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.RelativeLayout; <========== The import statement is here
import android.widget.TextView;
import java.util.Random;
public class FunFactsActivity extends Activity {
private FactBook mFactBook = new FactBook();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fun_facts);
final TextView factLabel = (TextView) findViewById(R.id.factTextView);
Button showFactButton = (Button) findViewById(R.id.showFactButton);
RelativeLayout relativeLayout = (ReletiveLayout) findViewById(R.id.reletiveLayout);
^=========== Error here
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
String fact = mFactBook.getFact();
factLabel.setText(fact);
}
};
showFactButton.setOnClickListener(listener);
}
}
2 Answers
Ben Deitch
Treehouse Teacher:) You've spelled relative wrong.
Ben Deitch
Treehouse TeacherRight-click > Refactor > Rename. And it will update it everywhere.
Caleb Kleveter
Treehouse Moderator 37,862 PointsI want to leave activity_main.xml the same. I want to change MainActivity to Signals from Mars. How is that done?
Ben Deitch
Treehouse TeacherSo you're trying to change the name of 'MainActivity' to be 'Signals from Mars'? If that's the case, it won't work because you can't have spaces in a class name. But you could change it to 'SignalsFromMars' or something like that, by right-clicking on 'MainActivity' (public class MainActivity) and choosing Refactor > Rename.
Caleb Kleveter
Treehouse Moderator 37,862 PointsI wanted to change the title of the activity. I decided to just created a new project.
Caleb Kleveter
Treehouse Moderator 37,862 PointsCaleb Kleveter
Treehouse Moderator 37,862 PointsThanks! That did it!
How do I re-name an activity?