Android Essentials: Learning and organizing activity and Intent intentions

Source: Internet
Author: User

Look here: Android Essentials: Learning to organize activities and Intent intentions

In the Android Essentials: Android UI Control in the understanding and learning, the Android UI to do a preliminary understanding and learning, this article continues the Android development learning finishing. Android apps are usually made up of one or more basic components, the most common being activity, and this is where we'll sort out the knowledge of activity and the intent intent of communicating with each other.


First of all, let's briefly introduce activity activities, (from Baidu Encyclopedia):

activity is a visual user interface that is displayed in response to user actions, an application can have one or more activity, each activty start, destroy, etc. contains a series of operations, activity learning is the most important to its life cycle of understanding, There is a brief summary of the activity life cycle, which you can refer to hereAndroid Essentials: Life cycle of Android activity, here is a simple description of the following image:

    The creation of activity is simple, just write a subclass that inherits Android.app.Activity and declare it in Androidmanifest.xml, similar to the following configuration:

< activity          android:name = ".activity.StartActivity"          android:configChanges = "keyboardHidden|orientation" > </ activity >

The above android:configchanges= "Keyboardhidden|orientation", used to configure whether the application toggles the screen when the declaration period is called back, which means no recall, here is a detailed description of Android: The Configchanges property.

Below, let's tidy up the intent intention, the first is a simple introduction (from Baidu Encyclopedia):

Communication between the activity can use intent, when starting another activity, we can pass intent intention, through the activity class provides startactivity method, intent class provides a from "from" to "recipient The constructor method Intent (context Packagecontext, class<?> CLS), receives the context of the current activity and the Class of the next activity, The same intent class also provides some way to encapsulate the data, which can be set by a bundle class like map, which is not discussed here.

The storage of data is mentioned here, and there are many ways to store data in Android, and persistent operations can be done via database or sharedpreferences,sharedpreferences using XML format for Android Application provides a permanent way of storing data in the /data/data/your_app_package_name/shared_prefs/ directory of the Android file system. can be accessed by all the activity in the same app, and can be persisted in data-like ( from the details of Android's Activity component ):


Summary: Activity is an important learning point in Android development, understanding the activity lifecycle, communication and data transfer between Android components in communication intent, is really a primer for Android. Finally thanks for the internet on the various ways the great God finishing articles, benefited.

Android Essentials: Learning and organizing activity and Intent intentions

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.