Activity 1 and androidactivity for learning four Android Components

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.