Activity 1 and androidactivity for learning four Android Components
Activity is one of the four most basic and commonly used components of Android. As an application component, Activity provides an interface for interacting with users. In this case, Activity is closely related to user operations. It is often used to interact with users. You can use setContentView to display components.
Today, we learn how to create an Activity.
Step 1: Create an Android Application Project and enter the Application name, Project name, and package name.
Click Next: the options below are default. Until
You can select an Activity to create it. Generally, Empty Activity is selected, and Blank Activity is used by default. Click Next to go to the Next step.
Is the default Activity name and layout file name. Of course you can modify your own. Click Finish
After finishing, it will show that effect. I will not talk about the meaning of folders in Android. If you are not familiar with it, you can read other materials for study.
Now that an Android project has been created, how can users see the interface?
SetContentView associates a layout file with the Activity, so that the corresponding layout interface can be loaded when the Activity is created.
Another point is that when you want an Activity to be started, you must configure it in the configuration file. Of course, you will be added to the configuration file by default when you create a file. How do you have another Activity and want it to start the Activity:
OK. In the preceding steps, you can create an Activity. Let's take a look at the running effect:
Is it very kind and familiar Hello World! Yes.
Lower Bound continue learning Activity
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.