• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Create a simple Layout

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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://coderanch.com/how-to/java/Java-FAQ
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic