• 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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
 
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic