Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create a simple Layout

 
Alex Garci
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm newbie in Android and I can't create a simple LinearLayout. I have the following code in several files:

Principal.xml



strings.xml



LayoutActivity.java



Errors are in the last file, when I try to change the main activity's name. I have errors in lines setContentView and getMenuInflater. The error is:

principal cannot be resolved or is not a field.

I save principal.xml file in res/layout and string.xml in res/values folder. LayoutActivity.java is in src/example.interfaces folder.

How can I fix this error?

I'm working with Eclipse and API Level 16.

Thanks.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Errors are in the last file, when I try to change the main activity's name. I have errors in lines setContentView and getMenuInflater. The error is:
principal cannot be resolved or is not a field.


why you changing the activity name? it won't compile until you fix the the same name for your file.

Java Rules:
The filename must match exactly the name of your class.

https://www.coderanch.com/how-to/java/Java-FAQ
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic