For me the issue was that I'm use to ending all lines of code with a ; and I had android:background="@drawable/splash_background";> deleted the ; and it's resolved. This was causing the R.layout.splash and the R.id.* to error out. I don't know if this is what anyone else was experiencing, but hope it helps.
so, i went through hell debugging this. first the splash wouldn't work at all. just got the add/sub program. i read that it may have been the version of the SDK or whatever, so i went and started a new project with 2.2, which ended in failure. SOLUTION: (Bundle savedInstanceState) instead of TravisLovesBacon or whatever. the splash.java and startingPoint.java have to have the same variable name in the bundle parameter or whatevs
Here is the easiest fix. All you have to do is type in R.layout.main. Change main for database. You do not need to delete the android.R or import anything. Thumbs up so others can see.
@freaky3ro Just click Run. If you have a phone plugged in to your computer, it will try to run it on the phone. Just remove the phone and it should run in the emulator (virtual device).
Everyone learning android from this tutorial..if your image isn't being detected in the setContentView( ) method, you can fix it by just deleting the "import android.R" directive from the top of the file..
hi, i m not sure why but my splash is in View but not in "int" as in the tutorial, i have deleted my splash.xml file again and again for several times and I still can't go through it !
I was exploring the Manifest and found something quite useful and I thought of sharing it. This tutorial talks about creating a new Activity file from scratch right? Of course it is good to know how to manually do it, but I found a way that you can do 80% of this video in just a few clicks.
1. Open the AndroidManifest.xml
2. Select the Application Tab
3. Scroll to the bottom, you should see the Application Nodes
4. Click on Add..
5. Choose Activity, click OK. Now you have created an empty (tbc)
@MrButtonclick Don't import the fully qualified name....just Delete the "import android.R" directive at the top...as others have said. This appears periodically when you "Clean" your project. After you delete it, the R.java file will be regenerated automatically and should correct any potential errors in the source location.
First: i did like tuttar3 said: add to splash.java - import packege_name.R;
Second: i deleted music file from folder "raw"( in name i used capital letters and Travis said in tutorials, that it is forbidden to use capital letters), so maybe error pop up becouse of capital letters in file name
can some one please tell me what is my emulator isn't working, i have no errors showing up in eclipse...but everything i try to run the app, it says it doesn't work...
Help pls..... i created new project so i could go get the gen folder that keeps disapearing.... and when i clean project so the R. error goes away Gen files keep disapearing
@delphi202002 Making a new splash.xml in layout solves the problem, I had to google for what to enter in there and found this page wwwDOTbarebonescoderDOTcom/2010/04/a-simple-android-splash-screen/ it tells you what to enter - you need to rename the appropriate parts
protected is not the same as private, private methods are only be accessed in the class where they are in protected can be used in classes that extend
If you guys got a ton of errors after you hit "Clean" in the last tutorial, you have to make sure that all of the files you put in the "res" folder (your background image and button sound) are all named without any spaces or weird characters. Then you need to go to the "Project" tab where you hit "Clean" before. Then uncheck the "Build Automatically" button on the dropdown menu, then right-click your project name on the side and click "Build Project". Then just hit "Clean" again. Hope it works:)
Can you please assume people have a basic understanding of programming as you make tutorials on specific technologies (eg: Android development). Maybe also let people know that if they are not familiar with basic concepts of OOP or Java that they should see your other tutorials.
Anyone know how to get the emulator to start fast like Traivis'? Mine shows two screens, then I have to swipe the unlock swiper to get it to run my example code
Well delete the android.R and hover over the layout code and you can click to auto-import. But yes, as I remember it's just package name and .R on the end.
@tuttar3 That's exactly right. After you've changed it to that, try right clicking on the project's name and say Build Project. Your errors should be gone now hopefully.
@thetmonaye It is sometimes imported automatically, but it is the wrong R, that is imported. Check the top of the code and see see if the imports are collapsed, press the plus to see all imports afterwards, see my reply with the solution so you imported the correct R related to your project.
For all of those people having trouble with the (R.layout.splash) problem, this may be the reason why. Check to make sure your R.java class is still this, under gen. If it is not, then start a new project. You can repeat class names and copy and paste most of the things. Another sign that this is what you need to do is that under your startingPoint.java class the (R.id.bAdd) and the other of those type will also have a problem. Hope this helped!
Ok, so apparently Eclipse will add an import android.R statement at the beginning of your java files. This is wrong and should be deleted. I deleted mine and ran the program and it resolved the splash error.
Can someone please HELP me get past the R.layout piece which for the life of me can't find where the problem began at within this tut. I read all the comments, played around with suggestions, but am coming up empty each time. Thanks everybody
I have the same problem, also with R.id., none of the references to the xml pages seem to work, or stop working after a while for no reason. Any solutions?
Hey, I really appreciate these tutorials, but I gotta file a gripe...
I think you need to do a better job of following Java standard practices. In this tutorial you finally at least noted that you started a class witha lower-class letter (but didn't fix it!). But then you went on to start a variable name with an upper-case letter!
For inexperienced Java developers, you're setting some very bad examples. For experienced Java developers, you're driving us crazy (for the most part =P)!
These are good Android tutorials, but he's expecting you to know Java. He says he isn't, but if you don't already know Java (or at least the basics of Object Oriented Programming) you're going to be very lost very fast. You should really watch at least the first 10-15 of The New Boston's Java tutorials.
@chaimss If you listen to the first one or maybe it was in the description, bucky(the dude who did the first few tutorials) said watch my java tutorials first.
You can subscribe to this playlist. Click on "Android Application Development Tutorials (thenewboston)" playlist link under my comment. Thumbs up to help others!
Super means the class that's this class' master. This class extends Activity, and therefore is Activity the master of Splash. For example: You have the onCreate of monsters, and the onCreate of AlienMonster. AlienMonster extends Monster to implement the monster basic attacks and movement code. It runs the constructor, or in this case, onCreate. And in this case, it runs the onCreate of alienMonster, then runs the code of Monster to add movement and stuff, and the proceeds with alienMonster.
Quick tip: Instead of writing "extends Activity" and that, when creating a class at the "Superclass:" line, click "Browse..." and write/select Activity
Get rid of the line, then start typing the code manually
Type until you get to the brackets and press R. then wait until the list comes up
then you want to type Layout then look for the layout with com.(projectName).android.R underneath the words layout and click that then put splash afterwards
For me the issue was that I'm use to ending all lines of code with a ; and I had android:background="@drawable/splash_background";> deleted the ; and it's resolved. This was causing the R.layout.splash and the R.id.* to error out. I don't know if this is what anyone else was experiencing, but hope it helps.
ampere11 1 week ago
so, i went through hell debugging this. first the splash wouldn't work at all. just got the add/sub program. i read that it may have been the version of the SDK or whatever, so i went and started a new project with 2.2, which ended in failure. SOLUTION: (Bundle savedInstanceState) instead of TravisLovesBacon or whatever. the splash.java and startingPoint.java have to have the same variable name in the bundle parameter or whatevs
AustinShred 1 week ago
Here is the easiest fix. All you have to do is type in R.layout.main. Change main for database. You do not need to delete the android.R or import anything. Thumbs up so others can see.
HIHAYTAH 2 weeks ago 2
"splash cannot be resolved or is not a field"
anyone know what I did wrong? Everything looks the same. I've closed out of eclipse and restarted, which sometimes helps. And Cleaned it too...
kaylajo8492 2 weeks ago in playlist Android Application Development Tutorials 2
I wish my middle & last name were "love" & "bacon" respectively. :(
quietpopcorn 2 weeks ago in playlist Android Application Development Tutorials
how do i run my app in the virtual device?
freaky3ro 3 weeks ago in playlist Android Application Development Tutorials
@freaky3ro Just click Run. If you have a phone plugged in to your computer, it will try to run it on the phone. Just remove the phone and it should run in the emulator (virtual device).
C0GSniper 2 weeks ago in playlist TheNewBoston - Android Application Development
Thanks Travis for making this tutorial series...I have been following them carefully and they are really helping me learn about making android apps.
LegitFish 3 weeks ago in playlist More videos from thenewboston
Everyone learning android from this tutorial..if your image isn't being detected in the setContentView( ) method, you can fix it by just deleting the "import android.R" directive from the top of the file..
SlimShinoda19 1 month ago
This has been flagged as spam show
Excuse me? Please someone tell is onCreate method necessary? Thank you so much
90158160 1 month ago in playlist Android Application Development Tutorials
Comment removed
90158160 1 month ago in playlist Android Application Development Tutorials
Comment removed
90158160 1 month ago in playlist Android Application Development Tutorials
Comment removed
90158160 1 month ago in playlist Android Application Development Tutorials
so can someone explain to me what the setcontentview() function actually does? I cant find a clear explanation for it :p
XxKrNaGexX 1 month ago in playlist Android App Development Tutorials (thenewboston)
@XxKrNaGexX what setcontentview() does is it allows you to select a different layout file, so you can make different pages in you application
TheKillerremijn 1 month ago
thenewboston i want to ask you that i can try this for windows 7?I mean that the settings are same?
abdulmoeedkhan1988 1 month ago
my button noise was called button1 and u cant have numbers in the names -.-
unknown0man 1 month ago
hi, i m not sure why but my splash is in View but not in "int" as in the tutorial, i have deleted my splash.xml file again and again for several times and I still can't go through it !
thetmonaye 1 month ago
Very good tutorial...for the most part.
nsr4interpol 2 months ago
This has been flagged as spam show
I was exploring the Manifest and found something quite useful and I thought of sharing it. This tutorial talks about creating a new Activity file from scratch right? Of course it is good to know how to manually do it, but I found a way that you can do 80% of this video in just a few clicks.
1. Open the AndroidManifest.xml
2. Select the Application Tab
3. Scroll to the bottom, you should see the Application Nodes
4. Click on Add..
5. Choose Activity, click OK. Now you have created an empty (tbc)
lxLionHartxl 2 months ago
@lxLionHartxl empty Activity. Sorry about that.
lxLionHartxl 2 months ago
Comment removed
lxLionHartxl 2 months ago
Comment removed
lxLionHartxl 2 months ago
This has been flagged as spam show
@lxLionHartxl
6. Click the newly created Activity file
7. Click Add... Choose Intent Filter
8. On the right, you should see Attributes for Activity
9. Click on (underscored)Name*
10. Now this is the screen where Travis taught us how to create a new Java file. Give it a name. And click Finish.
Now if you would to see your package folder, the new java file is created along with all the methods created. Hope this helps you guys.
Do me a favour and like this post to help all the new learners!
lxLionHartxl 2 months ago 2
Good video.
ownage554 2 months ago
and it solved the problem :)
MrButtonclick 2 months ago
instead of " import android.R; "
i did like this " import com.thenewboston.travis.R; "
MrButtonclick 2 months ago
@MrButtonclick Don't import the fully qualified name....just Delete the "import android.R" directive at the top...as others have said. This appears periodically when you "Clean" your project. After you delete it, the R.java file will be regenerated automatically and should correct any potential errors in the source location.
david3165 2 months ago
void isn't a method, it's a type
funmacsta 2 months ago
Problem with R.layout.splash - my solution:
i do 2 thing, can't realy say what worked:
First: i did like tuttar3 said: add to splash.java - import packege_name.R;
Second: i deleted music file from folder "raw"( in name i used capital letters and Travis said in tutorials, that it is forbidden to use capital letters), so maybe error pop up becouse of capital letters in file name
BorissLevtin 2 months ago
This has been flagged as spam show
can some one please tell me what is my emulator isn't working, i have no errors showing up in eclipse...but everything i try to run the app, it says it doesn't work...
this link will show you what i mean:
facebook.com/pages/The-New-Boston/109188532473572?sk=wall&filter=1
thanks guys
xsxgotenxsx 3 months ago
@xsxgotenxsx check in everyone's post...thanks
xsxgotenxsx 3 months ago
How can you even pretend to do Android development without knowing the language? Learn java then droid development.
djpeteskix41 3 months ago
Help pls..... i created new project so i could go get the gen folder that keeps disapearing.... and when i clean project so the R. error goes away Gen files keep disapearing
hazzncrazy 3 months ago
helpppppp R cannot be resolved to a variable..ERROR
hazzncrazy 3 months ago
at 1.48 seconds when you have to "import the activity class" i do not get that option. i get all the rest below but not the one in the tutorial.
delphi202002 3 months ago
setContentView(R.layout.splash);
Can not resolve, and typing it manually does not bring up
com.(projectName).android.R
Detectionable 3 months ago
me too. was there a resolution to this?
delphi202002 3 months ago
@delphi202002 Making a new splash.xml in layout solves the problem, I had to google for what to enter in there and found this page wwwDOTbarebonescoderDOTcom/2010/04/a-simple-android-splash-screen/ it tells you what to enter - you need to rename the appropriate parts
Detectionable 3 months ago
@delphi202002 i went through the tutorial for the splash screen agan and now it works...i think i may have missed a capital letter in Activity
delphi202002 3 months ago
protected is not the same as private, private methods are only be accessed in the class where they are in protected can be used in classes that extend
ShallowHeartNB 3 months ago in playlist TheNewBoston - Android Application Development
you say "for the most part" alot
Frostbiyt 4 months ago in playlist Android Application Development Tutorials 3
ur the same guy as cornboyz
praveenchukka 4 months ago
If you guys got a ton of errors after you hit "Clean" in the last tutorial, you have to make sure that all of the files you put in the "res" folder (your background image and button sound) are all named without any spaces or weird characters. Then you need to go to the "Project" tab where you hit "Clean" before. Then uncheck the "Build Automatically" button on the dropdown menu, then right-click your project name on the side and click "Build Project". Then just hit "Clean" again. Hope it works:)
subliminalbear37 4 months ago in playlist Android Application Development Tutorials
home made java!!! :)
revealeddarkness 5 months ago
the emulator start tooooooooooooooooooooo slowwwwwwwwwwwww
how can i fix this? it takes half of an hour to run this tutorial apps!!!!
SuperAvailable123 5 months ago
Can you please assume people have a basic understanding of programming as you make tutorials on specific technologies (eg: Android development). Maybe also let people know that if they are not familiar with basic concepts of OOP or Java that they should see your other tutorials.
NickEnchev 5 months ago
How do you edit the emulator's window size? It's TOO huge for my screen.
BloodyMagnificent 5 months ago in playlist TheNewBoston - Android
Could someone help please!!! whenever i try to click on the source and overide implement methods it says no method to override found for this type
MyDollar1 5 months ago
Anyone know how to get the emulator to start fast like Traivis'? Mine shows two screens, then I have to swipe the unlock swiper to get it to run my example code
tonymuilenburg 5 months ago
Love Bacon!
petermihaylov 5 months ago
This is a FIX for the R problem.
Sometimes Eclipse likes to import R in the top of your class, delete this and import the R which is related to your project instead!
If you need more help, reply.
CaptainMack16 5 months ago 5
@CaptainMack16 help... So fx if i named my src package "com.abe.dansk" i simply say:
import com.abe.dansk.R;
Instead of:
import android.R;
or what?
tuttar3 5 months ago
@tuttar3
Well delete the android.R and hover over the layout code and you can click to auto-import. But yes, as I remember it's just package name and .R on the end.
CaptainMack16 5 months ago
@tuttar3 That's exactly right. After you've changed it to that, try right clicking on the project's name and say Build Project. Your errors should be gone now hopefully.
Whitellama11 4 months ago
@CaptainMack16 im getting the error and theres no import on top of the code... :(
hazzncrazy 3 months ago
@hazzncrazy what editor are you using? It _has_ to import R
CaptainMack16 3 months ago
@CaptainMack16 hey, I need help, I am not sure how to delete the import R? I recognized that I have not imported it in the first place?
thetmonaye 1 month ago
@thetmonaye It is sometimes imported automatically, but it is the wrong R, that is imported. Check the top of the code and see see if the imports are collapsed, press the plus to see all imports afterwards, see my reply with the solution so you imported the correct R related to your project.
CaptainMack16 1 month ago
@thetmonaye hey I got it but now the splash stops very soon and didnt connect with the app :(
thetmonaye 1 month ago
void means that it doesnt have to have a return value.
if u had public int Number(int Number)
you would have to return an int.
vasterhaninge 6 months ago
Hey everyone,
I'm also stuck. Perhaps someone will help c:
In StartingPoint.java on the line: setContentView(R.layout.main);
i get an error "main cannot be resolved or is not a field"
so i click the lightbulb x error icon and it says "Rename in file (Ctrl+2, R)"
I tried deleting ''import android.R'' statement at the beginning but then R 'cannot be resolved to a variable'
Also when we click 'Override/Implement Methods' i get 'No methods to override found for this type.'
help a newb!
AlecPerkey 6 months ago in playlist Android Thenewboston
For all of those people having trouble with the (R.layout.splash) problem, this may be the reason why. Check to make sure your R.java class is still this, under gen. If it is not, then start a new project. You can repeat class names and copy and paste most of the things. Another sign that this is what you need to do is that under your startingPoint.java class the (R.id.bAdd) and the other of those type will also have a problem. Hope this helped!
Werewolfsnowcone713 6 months ago
great
fad91 6 months ago in playlist TheNewBoston - Android
Ok, so apparently Eclipse will add an import android.R statement at the beginning of your java files. This is wrong and should be deleted. I deleted mine and ran the program and it resolved the splash error.
Paul8580 6 months ago 3
Comment removed
Paul8580 6 months ago
Can someone please HELP me get past the R.layout piece which for the life of me can't find where the problem began at within this tut. I read all the comments, played around with suggestions, but am coming up empty each time. Thanks everybody
Alpentalrider 6 months ago 16
@Alpentalrider Delete import R;
Tusharchutani 3 months ago in playlist Android App Development Tutorials (thenewboston) 2
@Alpentalrider
Make sure the Class splash.java is in the same package. In this video the class have to be in com.thenewboston.travis
greets and merry christmas :)
TheIStrobel 2 months ago
I have the same problem, also with R.id., none of the references to the xml pages seem to work, or stop working after a while for no reason. Any solutions?
TullioK 1 month ago
Hey, I really appreciate these tutorials, but I gotta file a gripe...
I think you need to do a better job of following Java standard practices. In this tutorial you finally at least noted that you started a class witha lower-class letter (but didn't fix it!). But then you went on to start a variable name with an upper-case letter!
For inexperienced Java developers, you're setting some very bad examples. For experienced Java developers, you're driving us crazy (for the most part =P)!
thedouglyuckling 6 months ago in playlist TheNewBoston - Android 3
These are good Android tutorials, but he's expecting you to know Java. He says he isn't, but if you don't already know Java (or at least the basics of Object Oriented Programming) you're going to be very lost very fast. You should really watch at least the first 10-15 of The New Boston's Java tutorials.
chaimss 6 months ago in playlist TheNewBoston - Android 46
@chaimss Thanks, that clears up some stuff.
PancakePlease 6 months ago
@chaimss If you listen to the first one or maybe it was in the description, bucky(the dude who did the first few tutorials) said watch my java tutorials first.
fagngheynstufflol 4 months ago in playlist Android Application Development Tutorials
@chaimss yep
dvzqz87 3 months ago
@chaimss u mean 100 - 150
devilazpl 1 month ago
If your last name is bacon the r u related to Kevin bacon?????
Zjgamer 6 months ago
A good way I was taught to think of activity's is the equivalent of one page on a site
FFWDEntertainment 6 months ago
Bucky and Travis, they both love naming variables 'bacon'
ErichLancaster 6 months ago
@SkimpyDoughnut
I also got the same error.but in the video,in layout folder i saw a splash.xml
We dont have it on our project.from where are we supposed to find that xml file??
rehrumesh 6 months ago
@rehrumesh Find the xml and put it in your layout folder
Avineshhd 6 months ago
And then everyone watching this video began calling their loved ones "love bacon"
dirnol 6 months ago
This has been flagged as spam show
You can subscribe to this playlist. Click on "Android Application Development Tutorials (thenewboston)" playlist link under my comment. Thumbs up to help others!
xGrowler 6 months ago in playlist Android Application Development Tutorials (thenewboston)
Guys do go through Bucky's or Travis's Java tutorials if nothing makes sense
arseshan 6 months ago
Every time I try running the application in the Emulator, I get the stopped unexpectedly error.... Any fixes for this?
letzshuffle95 6 months ago
@letzshuffle95 switch Graphical Layout tab of main.xml to Android 2.2 and in Android Manifest make sure android:versionName equals 2.2
Jampurer 6 months ago in playlist TheNewBoston - Android
Super means the class that's this class' master. This class extends Activity, and therefore is Activity the master of Splash. For example: You have the onCreate of monsters, and the onCreate of AlienMonster. AlienMonster extends Monster to implement the monster basic attacks and movement code. It runs the constructor, or in this case, onCreate. And in this case, it runs the onCreate of alienMonster, then runs the code of Monster to add movement and stuff, and the proceeds with alienMonster.
joannis11 6 months ago
Quick tip: Instead of writing "extends Activity" and that, when creating a class at the "Superclass:" line, click "Browse..." and write/select Activity
X3N4T3 6 months ago 2
@X3N4T3 good tip thanks
nesportskid 6 months ago
for some reason I got an error with
setContentView(R.layout.splash);
where the "splash" variable isn't recognised?
SkimpyDoughnut 6 months ago
@SkimpyDoughnut Me too :(
mangopearandapples 6 months ago
@SkimpyDoughnut I found out now.
Get rid of the line, then start typing the code manually
Type until you get to the brackets and press R. then wait until the list comes up
then you want to type Layout then look for the layout with com.(projectName).android.R underneath the words layout and click that then put splash afterwards
hoped it helped
mangopearandapples 6 months ago
Comment removed
SkimpyDoughnut 6 months ago
@mangopearandapples I don't get one with (projectName).android.R
SkimpyDoughnut 6 months ago
@mangopearandapples Nevermind! Got it working again! I just remade the Java file! :)
SkimpyDoughnut 6 months ago 2
@SkimpyDoughnut ..even I was having splash problem...I too remade the java file and then it came...thanks for the post...
sweet2smart 6 months ago
@SkimpyDoughnut That was a very simple fix for a problem that was driving me bat-shit insane. Thank you, sir.
subliminalbear37 4 months ago
Thanks for not making the tutorials extremely long. Seems like I get more videos done quicker!
baseball4355 6 months ago 2
more tutorials ! :O
mastermax7777 6 months ago