File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Cant seem to figure out this error when referencing a class using setContentView Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Cant seem to figure out this error when referencing a class using setContentView " Watch "Cant seem to figure out this error when referencing a class using setContentView " New topic
Author

Cant seem to figure out this error when referencing a class using setContentView

Sam Acropolis
Greenhorn

Joined: Sep 30, 2012
Posts: 16
So I made this new Java Class called splash which will be used to display a background image in my app . I wrote a onCreate method and then added this line so the image can be referenced and be placed in the "background" .



the entire code in the Splash class:



The Error that complains on "splash" in setContentView

splash cannot be resolved or is not a field


I dont know if something has to be created in the R.Java file , from what I know its a no-no to touch that ...

any idea?

Thanks everyone
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42595
    
  65
Indeed, never mess with the R class. It sounds as if you don't have the layout file that the code is trying to load; it should be called res/layout/splash.xml - that's what R.layout.splash does. Did you create that file?


Ping & DNS - my free Android networking tools app
Sam Acropolis
Greenhorn

Joined: Sep 30, 2012
Posts: 16
OMG , I totally missed that !! Forgot to create a splash.xml file in the layout folder!

Thank you so much man!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cant seem to figure out this error when referencing a class using setContentView