How to implement Android Splash Activity in easy way.

Step By Step Implementation of Android Splash Screen.

1) first we need to create new project in android studio.

2) After Open Mainactivity.xml file.and add imageview in activity.

3) After create new activity (ex.login).

4) Add code in mainactivity, 

  new Handler().postDelayed(new Runnable() {

    @Override
public void run() {
// This method will be executed once the timer is over
Intent i = new Intent(MainActivity.this,login.class);
startActivity(i);
finish();
}
}, 5000);
5)Run the project.
6)your splash screen are successfully added in Your app.

========================================================================

Here, 

postDelayed() : This function delays the process for a specified time.

Handler()postDelayed()  used with a handler which allows you to send and process Message and Runnable objects associated with a Thread’s MessageQueue. Each handler instance is a single thread.


After project successfully Run,

The project used in this blog is just for example purpose.
   
 Hope you learned something new today.
 Have a look at our Android tutorials.

 Do share this blog with your fellow developers to spread the knowledge.     You can read more blogs on Android on our blogging website.

  Happy Learning :)

--------------------------------------------------------------------------------------             Share this blog to spread the knowledge


Comments

Popular posts from this blog

🔥 Java Exception and Error Handling

Understanding How OOP Concepts Work with Real-Life Examples

🌿⚙️ Spring Boot Simplified