Crazy Android Handouts-Learn notes (iv)

Source: Internet
Author: User

Android apps typically have more than one activity, and multiple activities make up the activity stack, with the activity currently at the top of the stack. Activity is equivalent to a servlet for Java web development. When activity is running on Android apps, it is also controlled by the system and has a lifetime.

4.1 Setting up, configuring, and using activity

4.1.1 Activity building its own activity requires the integration of activity base classes, which can sometimes be integrated into the activity's subclasses in different scenarios.

Activity indirectly or directly inherits the base classes of context, Contextwrapper, contextthemewrapper, etc., and can call their methods directly.

Creating an activity requires implementing one or more methods, the most common of which is the OnCreate () method, which then calls the Setcontentview () method to display the view to be displayed when the activity is created with a callback. The Findviewbyid () method gets the components in the interface.

( source \04\4.1\otheractivity)

4.1.2 Configuring an Activity Android app requires that all application components be explicitly configured.

4.1.3 start, close activity with finish () method End ( source \04\4.1\startactivity)

4.1.4 uses bundles to exchange data between activity: The Messenger intent,intent between the activity provides multiple overloaded methods to carry data.

( source \04\4.1\bundletest)

4.1.5 Start other activity and return results

( source \04\4.1\activityforresult)

Callback mechanism of 4.2 activity

4.3 Activity's life cycle and loading mode

Activity is managed by Android in the form of an activity stack, and the activity currently active is at the top of the stack. Activity has roughly 4 states: active, paused, stopped, destroyed.

The life cycle of 4.3.1 activity P263

Similarities and differences between activity and servlet in 4.3.2

4 modes of loading for 4.3.3 activity

4.4 Fragment Detailed

4.4.1 Fragment Overview

4.4.2 Creating fragment

( source \04\4.4\fragmenttest)

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.