Android App Development: Creating Splash Screen

In this tutorial, you’ll learn how to create a splash screen which can be used to show your logo and play an intro song.

Firstly create the default blank android project with the default main activity.
For this splash screen we are using a background image (1080×1920) called ‘splash.png’, which is placed in the ‘res/drawable-hdpi’ folder. Also place a song called ‘splashsound.mp3’ in the ‘res/raw’ folder.

Create the ‘splash.xml’ file in the ‘res/layout’ with the following content:
[cc lang=”xml”]
< ?xml version="1.0" encoding="utf-8"?> [/cc]

Then add the file as below to your package in the src folder.
[cc lang=”java”]
package com.codinglogbook.example;

import android.content.Intent;
import android.os.Bundle;

public class Splash extends Activity {

MediaPlayer introSong;

protected void onCreate(final Bundle savedInstanceState) {
// background music – simpler to setup
introSong = MediaPlayer.create(Splash.this, R.raw.splashsound);


// SoundPool used for small clips 1 or 2 seconds
final Thread timer = new Thread() {

public void run() {
try {
} catch (final InterruptedException e) {
} finally {
final Intent openStartPoint = new Intent(“.MAINACTIVITY”);

protected void onPause() {

Finally update the ‘AndroidManifest.xml’ to include the splash activity as the launcher and the main activity as the defalut:
[cc lang=”xml”]
< ?xml version="1.0" encoding="utf-8"?>


Android App Development: How to add icon for the application?

If you intend on your application being available on a large range of devices, you should place your application icon into the five different res/drawable... folders provided. In each of these folders, you should include a correctly sized icon:

  • drawable-ldpi (120 dpi, Low density screen) – 36px x 36px
  • drawable-mdpi (160 dpi, Medium density screen) – 48px x 48px
  • drawable-hdpi (240 dpi, High density screen) – 72px x 72px
  • drawable-xhdpi (320 dpi, Extra-high density screen) – 96px x 96px
  • drawable-xxhdpi (480 dpi, Extra-Extra-high density screen) – 144px x 144px

You may then define the icon in your AndroidManifest.xml file as such:


Android App Development: How to make an activity fullscreen

In order to make an activity full screen simply add the following lines to the onCreate() method as follows:

[cc lang=”java”]

// make full screen
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);