Activity Preference (Design) In Android - Day Two


In this article we will study how to design the user interface and implement some easy code, but it is mandatory you have some experience in creating Android Studio projects. Now we will discuss the following topics.
  • Starting Another
  • Activity Respond to the Button
  • Create the Second Activity
  • Web View
  • Saving Data
  • Saving Key-Value Sets
Before starting, I would like you to visit the previous article
Step 1- Now open the Android Studio and click on a new project, then press next button, choose the API level, and select Empty template with now activity; now left-click on res folder and create a directory and give the name layout and then press Ok button
Click ok
Step 2- Now left click on the first directory and give the name Main Activity; now you see that layout session the content.xml file appears to have deleted this file because it is not necessary for us.
new activity
Delete content
Step 3- Now when Home Activity is created press double click on the class file and delete the following code because it is not essential for us.
class file
Step 4- Now after deleting the code you create more activities, you have two options for creating an activity. The first one is the previous method and the second is that you click on the class file and press Ctrl C and then Ctrl V and then change the activity name and  you simplt make the layout section also. The following picture is given below forthe hierarchy of activities and layouts.
layout section
Step 5- Now mention all the activities' names in the AndroidManaifest.xml file and also add internet reference permission for using the app in the future. I will make clear to you how I added INTERNET reference in this file.
AndroidManaifest.xml file
Step 6- Now in Home activity we add two buttons in layout and set the name. We have two options; first, we create a button with code and second, we drag and drop, but this is not a good practice. Now I am showing code as well as button.
Home activity
Step 7- Now we make a scenario that when the user presses the BROWSER button any following URL is open so in this first, we will work on the file and add this code in Java file and we will implement the layout file by taking the Web View.
Now open file and paste these two lines in it and then run the application
Step 8- Now move to the class and add this code in it and we use intent classes to open other activities like Bowser activity
Step 9- Now click on the Browser button and you can see that Google is open; now you can search anything here but remember that you add INTERNET permission in the AndroidManifest.xml file. 
Read more articles on Android