Android Development Portal Activity

Source: Internet
Author: User

How does the portal for Android Development Activityadnroid app determine entry activity?

Is it because class is called mainactivity, the layout file is called Activity_main.xml?

If you think so, it's a big mistake.

It is possible to determine the entry activity because it is configured in the application's manifest file, and the system is established based on the application's manifest file (androidmanifest.xml).

How to establish, what is the mark?

Let's take a look at the list file and see at a glance:

By the way, the system can be established because of the intent filter of the Red line callout Intent-filter

The system accesses all intent-filter in the manifest file until the following code is found:

<action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" />

Depending on the name of the activity in which it is located, find the entity class of activity that needs to be started.

So can we define two entry activity?

The answer is yes. Let's try it again, create a new activity, name secondactivity, register the activity in the manifest file, and set its intent filter as the primary activity.

In addition, we will find an interesting phenomenon:

Is it found that launching an app generates two icons, yes, each entry activity will generate an icon corresponding to it.

When we click on the test icon, we will enter the mainactivity, but we will enter the secondactivity when we click on the secondactivity icon, that is to say, an application has two entrances, which is obviously not good, we should strictly stipulate that There is only one entry activity, do not want to act wonderful!!!

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Development Portal Activity

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.