Android interview question Activity, androidactivity

Source: Internet
Author: User

Android interview question Activity, androidactivity

  • Activity Four startup Modes
Standard, singleTop, singleTask, and singleInstancestandard: when an Activity is activated (startActivity), the Activity instance is created and placed into the task stack. singleTop: if an instance of the Activity exists at the top of the stack of the task, the instance is reused. Otherwise, a new instance is created and placed on the top of the stack (even if the Activity instance already exists in the stack, instances will be created as long as they are not at the top of the stack ). SingleTask: if the Activity to be activated exists in the task stack, you do not need to create it. You only need to place the Activity to the top of the stack, and popsingleInstance for all the Activity instances above the Activity: If the MainActivity instance is created in the task stack of Application 1, if application 2 also needs to activate the MainActivity, it does not need to be created, the two applications share the Activity instance.
  • Activity display start and hide start
Show start directly set class start intent
Implicit startup (1) Matching Based on Action and Category (2) Matching Based on Action and Data (3) Matching Based on the mimeType attribute of action and data (4) A single Activity can have multiple <intent-filter> </intent-filter> pairs. If one of them is matched, the Activity can be started.

  • Fragment usage
Static and Dynamic use
  • Activity Lifecycle
    OnCreate-> onStart-> onResume-> onPause-> onStop-> onDestroy

  • Fragment Lifecycle
OnAttatch-> onCreate-> onCreateView-> onActivityCreated-> onStart-> onResume-> onPause-> onStop-> onDestoryView-> onDestory-> onDetach

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.