Best Way to Make a Splash Screen in Android
In this article, I will tell you about how you can make intro screen in android studio and also will understand intro screen importance that free 100 percent, also ask you to better practices, as you can see in this pic,Best Way to Make a Splash Screen in Android.
What is splash screen?
When we start any application, we see come to the first page that is known as a splash screen.we can also say the introduction screen, and In this article, we will learn the splash screen beginning to end and its Best Way to Make a Splash Screen in Android.
1.How you can make splash screen?
3.Why important Splash Screen?
1.How you can make splash screen?
First, we will go to Android studio.
after that, we will make activity in the android studio so it’s a very simple way you can make it, First, open java folder then right-click on package name then you will see like this screen click on new then next page you will see activity then again you see next page and click on the empty activity, then enter a name in empty activity splash activity and click on finish its Best Way to Make a Splash Screen in Android.
After making an activity, we have found two things, one is an XML file, and 2nd is splash activity .java file. its Best Way to Make a Splash Screen in Android.
Works in splash screen:
Design and Front end work>>
In first we will work in splash activity XML, so first,
we will design layout so that we will make a Logo for the splash screen, so I took the youtube logo for it after getting this paste in drawable folder, then change constraint layout with the Relative layout.
After that, we will set the image because the image should be in the center, so layout width and height set 120dp then the logo should be in the center, in search bar write center and select center then you will get one option center parent select it.its Best Way to Make a Splash Screenin Android.
Then one text adds bottom All Rights are Reserved then adjust text size.
Splash Activity java and Back end work>>
We will work in the back end delay time for a splash screen so that we will use thread class.
First, we will make an object of thread class.
Thread is java building class, and we use it when we have to work more than one mean parallel, as like front and back end work difference,
Now we will work in the thread we get method in the thread as run.
How you can write method in the thread first write access specify then return type and then function and at last write method name.now will give delay in try-catch,try-catch is known as exception handling and try-catch we are using there when any error occurs.
In the Try, we will use that code in which error occurs, the benefit of Exception E to write application not crash if happen error of any code, and Finally, we put that code run in every situation.its Best Way to Make a Splash Screen in Android.
How we can delay in splash screen>>
Write in try sleep and then time set as your requirement, and in exception, e write e.printstackTrace for file not found then in Finally we will use Intent.
Finally, we will run one Intent, in java intent use for moving to one activity to another activity, we make an object and write the name of that activity we use in the first paragraph mean Splash screen and also write 2nd activity that is Mianactivity.class. Then write start activity and pass Intent.
At last, we will use thread. Start, so now our delay time started. Now splash screen work is completed, but one task is left and its Best Way to Make a Splash Screen in Android.
How you can change splash activity into launcher activity>>>
How can we change splash activity into launcher activity first? We will go into manifest; you can see the intent filter in the main activity, so copy this and paste into splash activity, splash activity is shown in the launcher. Now your splash activity becomes launcher activity.
Now you can run your application with a splash screen. Now hide your action bar. It’s straightforward type in splash screen getsupportactionbar.hide and now your toolbar will not show. its Best Way to Make a Splash Screen in Android.