Android learning-day 5 and day 5

Source: Internet
Author: User

Android learning-day 5 and day 5

Learning Content: Activity Interaction and UI Fragment Components

 

=== Activity INTERACTION ====

The application scenario is generally that the current Activity requests another Activity to display details (such as personal details), or to process Association logic (such as editing images)

When two or more activities are ready, the basic processing process is as follows:

1. Add activity information to the AndroidManifest. xml file, as shown below:
<Manifest xmlns: android = "http://schemas.android.com/apk/res/android"
Package = "package. name">

<Activity
Android: name = ". CheatActivity"
Android: label = "@ string/app_name"/>
</Manifest>

Android: indicates that the package in manifest is prefixed and registered.

 

2. Use startActivity/startActivityForResult to start another Activity view. The difference between the two methods is whether to return information.

Call Activity. The process is as follows:

 

3. The Intent component is used for interaction between activities. The Intent component is mainly responsible for communication and information interaction with the OS, and does not directly allow interaction between activities.

Communication, but uses Intent as the middleware. The advantage is that it can start a specific Activity across applications. If I request to open a webpage, the corresponding browser should

The Activity itself does not need to be able to process webpages.

 

Intent Brief Introduction: it is mainly responsible for interactive communication with the OS and can carry additional information so that data can be performed between two activities.

Transmission, which has two forms: Display and implicit. The display specifies the Activity explicitly, which is generally internal to the application.

Application. In general, I don't know which external applications are available, so I need to make implicit calls so that specific applications can respond to my call requests!

 

=== UI Fragment component ====

Fragment is a flexible UI component attached to the Activity, which makes the UI layout attempt and processing quite flexible. Currently, there are many applications, and it has

Similar to Activity, the life cycle and View can process UI interaction, and have their own layout files. The usage is similar to Activity components!

 

Fragment focuses on familiarity with lifecycle and management methods:

A) Lifecycle

========================================================== ====

 

B) Management Method

==========================================

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.