How to start a new Activity in Android
As we create first app of android name “AddingTwoNumbers” let’s continue with this app and add more feature e:g When app start/open there is a image as a background and after 5second the activity change.
This is the link of first app! https://shinersoft.net/blog/add-two-numbers-android/
Let’s start…
Step# 01
Open a AddingTwoNumbers project there already one activity present name activity_two_numbers.XML
Now create another activity file for splash screen right click on layout then new->file and give the name of file name splash.XML remember the file name must start with lower case letter.
Step# 02
Now add image in drawable-Hopi folder which is used to splash screen background. Download any image and named it Splash background or whatever.
Step# 03
Now refresh the folder if you don’t able to see the splash image in folder right click and then refresh.
Now right code for splash.XML
Step# 04
Now add class in src folder right click on com.example.addingtwonumbers and then click New->Class
Now right click between the brackets then go to source->override/Implement Methods like this
After this you can see another window select on create then ok.
Now you can see Splash.java in this condition.
SaveInstanceState this is the variable here you write your own name or any other name just like this.
Now set the content view and timer of splash screen in next screen shot by using try catch and finally.
Step# 05
Open androidmanifest.xml to decide which activity is to open first set the activity tag under the application tag
Step# 06(Result)
After 5 second you can see this activity on the screen.
Another Feature discuss is in next tutorial thanks
Social