Android development: Notes

Source: Internet
Author: User

1. I just found an amazing thing. In tabactivity, gettabhost () is used (). setcurrenttab (2); set the current subactivity to the first, for example, the second, but the first subactivity will still create. Currently, we do not know the situation after create and whether it is related to setdefatab tab.

2 In activitygroup

@ Override
Public void onbackpressed (){
// Todo auto-generated method stub

Super. onbackpressed ();
}

Will not be called.

3 activity has two functions that can be reloaded. It looks interesting.

Void Onpostcreate (bundle savedinstancestate) Called when Activity start-up is complete (afteronStart()AndonRestoreInstanceState(Bundle)Have been called ).
Void Onpostresume () Called when activity resume is complete (afteronResume()Has been called ).

You have to consider the usage.

4. the lifecycle of an activity is stack-based. For details on this document, create-> Start-> resum-> pause-> stop-> destroy. When power saving is locked, the activity enters the pause state, the active push to the background enters the Stop State (the home key, do not know whether the return key is), and CALLS finish directly to enter destroy. if the background is forcibly reclaimed, destroy is not called, if a program breaks into the foreground, is the current program like pause or stop?

Interestingly, activitygroup is associated with the subactivity lifecycle. For example, activitygroup group and subactivity Sub:

Groupcreate-> subcreate-> substart-> groupstart-> subresume-> groupresume-> subpause-> grouppause-> substop-> groupstop-> subdestroy-> groupdestroy

Switch from suba1 to the new suba2, suba1pause-> suba2create...

The switching between them is the form of pause and resume first.

After both suba1 and suba2 are started, stop at suba1, and finish:

[SubA1-pause]-> [Group-Pause]-> [subA1-stop]-> [subA2-stop]-> [Group-Stop]-> [subA1-Destroy]-> [subA2-Destroy]-> [group-destroy]

If you stay at suba2, yes

[SubA2-pause]-> [Group-Pause]->...

That's it.

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.