It's not a secret anymore!*
The moose likes Android and the fly likes Create a simple Layout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Create a simple Layout" Watch "Create a simple Layout" New topic
Author

Create a simple Layout

Alex Garci
Greenhorn

Joined: Feb 14, 2012
Posts: 15
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

Joined: Dec 06, 2005
Posts: 1321

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


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
 
 
subject: Create a simple Layout
 
Similar Threads
launch skype after click button in the app
Maps are not show in Emulator
Problems with listview and checkbox event
Why not correct run my program?
Android Emulator Throwing Error in Eclipse