How to use Splash Screen in Android

April 7, 2014 | Rishabh Agrawal | General

Android splash screen are basically used to show Company logo for a couple of second before the app loads completely. In this article we are going to learn how to implement splash screen in your android application.

// This is the game class of your game.

public class CreatioGame extends Game
{
@Override
public void create()
{
this.setScreen(new Splash(this));

// This is how you call a screen
}
}

// This class is called form game class. All the loading of assets of your game is done here.

public class Splash implements Screen
{
private SpriteBatch spriteBatch;
private Texture splsh;
private Game myGame;

/**
* Constructor for the splash screen
* @param g Game which called this splash screen.
*/
public Splash(Game g)
{
myGame = g;
}
@Override
public void render(float delta)
{
// first we will clear the screen

Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

// draw the splash image here

spriteBatch.begin();
spriteBatch.draw(splsh, 0, 0);
spriteBatch.end();

// This switches the screen if user touches the screen. Normally you will require this once all the assets are loaded in you game.
// will show you how to load Assets in your game in next Blog.

if(Gdx.input.justTouched())
myGame.setScreen(new GameScreen());
}

// this method is called once when screen is called. Initialize your varialbes here.
@Override
public void show()
{
spriteBatch = new SpriteBatch();
splsh = new Texture(Gdx.files.internal(“splash.png”));
}


THE AUTHORRishabh Agrawal

Rishabh Agrawal is the founder of Creatiosoft, a company focused on creating high-quality software for the iGaming industry, specialising in poker and card games. With years of experience, Rishabh is dedicated to delivering engaging and user-friendly gaming experiences. Through this blog, he shares his passion and insights to help readers understand the latest trends and advancements in iGaming.

Recent Posts

The Future of Mobile Gaming: What to Expect in the Next 5 Years

Over the years, mobile gaming has seen amazing development and innovation utilized by the game development company in India. It…
06 Jun 2023 Rishabh Agrawal

How Do I Get Started With NFT Gaming?

The popularity of the NFT game has created a different fan base. There was a time when games were a…
18 Jul 2022 Rishabh Agrawal

What Are The Top Trends in NFT Marketplace 2022?

The NFTs are the new engaging and revolutionary technology across the globe. Though, these non-fungible tokens appeared for the first…
09 Jun 2022 Rishabh Agrawal