Could anybody please advise how I can add a splash screen to my HTML5 Phonegap based Android App. I just want it to display for 5 seconds on load. Also – can anybody advise what dimensions the splash screen should be.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In order to have a splash screen in a PhoneGap Android application you need to put your
splash.pngfile intores/drawable-ldpi,res/drawable-mdpi,res/drawable-hdpi,res/drawable-xhdpi. Where those directories represent low, medium, high and extra large dots per inch. You’ll need to resize you splash.png (the file name is important here) for each directory or Android will stretch it for you.The sizes of each image should be:
Then in your main Java class, the one that extends DroidGap, you’ll need to add one line and modify another. First add:
this line should show up under
super.onCreatebut beforesuper.loadUrl. Then you’ll need to modify your loadUrl method to pause for 5 seconds before loading up the main page. It would look like this:That should do it for you.
I’ve recently made some updates to how the SplashScreen works on PhoneGap Android. The main app now loads while the splash screen is being shown. This is a big improvement over the previous blocking splash screen call. Read more about the changes on my blog.