How to Build Intro Slider for your App

Vaidhyanathan S M
Nerd For Tech
Published in
3 min readMay 8, 2020

Let us see how can we build an intro slider for your android application.

Preview

Let us go through step by step to get this final screen.

Create a new android project as usual and name the application as Intro Slider.

Please download the images if you want from here:

https://drive.google.com/open?id=1f7GeYwLnbCtnefynEX7rJGadiZGUD7P4

Firstly go to the colors.xml file and add the required colors:

Now, go to styles.xml and add the following to avoid the crashing of the app:

After that add the following to the dimens.xml file and if it doesn’t exists, create one.

Now, we need to add the following lines to the strings.xml file:

This is the text that we want to display on each screen of the slider. Also, we need to add an image to be displayed on the screen. So, download some four images and place them in the drawable folder or use the link given above to download the images. Now we need to create the layout file for the Intro Slider. Let us name the activity as WelcomeActivity. But before we even create the layout, we need to create the each slider layout as follows:

  1. welcome_slide1.xml

2. welcome_slide2.xml

3. welcome_slide3.xml

4. welcome_slide4.xml

Now, let us create the activity_welcome.xml

Now, also we need to note that the WelcomeActivity needs to run only once. Hence we will use SharedPreferences to save the state and check whether the application is running for the first time. If it is then we will show the WelcomeActivity or else we will move on to the MainActivity.

Let us create a class called PrefManager.java .

Now, we need to go to the WelcomeActivity.java and add the following:

Now, the final thing that we need to do is to make this WelcomeActivity as the launcher activity. So make the changes accordingly in the AndroidManifest.xml file as follows:

And now, Woah! We are ready to run our application and you should be able to see something like this:

Preview of the Intro Slider

Hope you enjoyed reading the article!

If you have any queries please post in the comment section below. Connect with me on LinkedIn . Also, if you want to look at my amazing collection of apps developed, don’t forget to check Google Play Store.

Know more about me here.

With that being said, thanks for reading my article and Happy Coding!

--

--

Vaidhyanathan S M
Nerd For Tech

Systems Engineer @TCS | Native Android Developer | Enthusiastic Programmer | Skilled in Python, C/C++, Java, Flutter and Flask.