My Android Interview Road (III: various states)

Source: Internet
Author: User

Every day, all kinds of states, all kinds of crap.

wow haha haha haha last night just write a notebook without electricity, a minute to send out to the Wow ha haha the following is yesterday--

A feeling up missed a start-up company's written test-(some students went to the scene to send an offer Beijing 30,001 months of formal work haha I will not vomit groove feel so play not friendly life AH)

Comments Some people say I'm talking nonsense and it's not good I'm just going to keep pulling

There are people who say I feel the wood, I do not know how to say feelings-(forgive me feeling low)

And someone said I wrote journal this ... All right

Speaking of various states, this state of the past is really uncomfortable. This afternoon also received a phone interview only asked a few simple Android questions (really very basic) and then asked to continue to Beijing interview (school recruit too much can not do AH) Ah or Beijing is more opportunities AH

Cough or state this thing think about the activity life cycle this question is the most frequently asked interviewer will be very happy to ask you

Like when you open an activity, and then a phone call. What are the life cycles that the activity has undergone? Or when you press the back key? Or when you press the home key?

Self-confident ~

"First of all, this activity has the following life cycle."

"OnCreate () OnStart () Onresume () OnPause () Onrestart () OnStop () OnDestroy ()"

    

is a map of Google (Pictures directly copied from other people's blog)

"First of all, say a normal activity from open to press the return key to exit the life cycle of the experience"

"OnCreate ()---> OnStart ()---> onresume ()--->onpause ()--->onstop ()---> OnDestroy ()"

"When the activity is created, first callback OnCreate () (once)---> Callback OnStart () (Visible non-interactive) when the activity is started---> Callback Onresume () (OnStart () when resuming activity will then be callback)---> Pause when callback OnPause ()---> Stop callback onstop ()---> Destroy when called OnDestroy () (back key or insufficient system resources kill low priority activity) "

"Then talk about the life cycle of activity from open to press home and back to experience"

"OnCreate ()---> OnStart ()---> onresume ()---> onPause ()---> onStop ()---> Onrestart ()---> OnStart ()- -->onresume () "

"The phone comes through the life cycle."

"OnCreate ()---> OnStart ()---> onresume ()---> onPause ()---> onStop ()"

After answering these questions, how do I normally use the activity life cycle

I load resources such as listview= (ListView) Findviewbyid (R.id.listview) in OnCreate (), (no time-consuming tasks)

Onresume () and OnPause () Two methods perform some symmetric operations

For example, when pausing to save some user data when recovery is resumed when a resource is paused when a resource is created to release some resources

and OnStart () do not perform very time-consuming operations within a method this is especially important because this period is visible and the longer the experience is, the worse it becomes.

And when the activity is not destroyed, it will callback Onrestart () when restarted.

There are also situations where the user activity is not visible through OnPause ()---> onStop () Phone call (new launch of a different activity) in this case, it's blocking the current activity.

Alertdialog this, in particular, shows that this does not affect the life cycle of the activity.

There are some of the computer to say that the wood has electricity (several years ago, the Dell Battery broke down 23 points lights out 20 minutes or so without electricity and 3 minutes left)

Wrote it up here yesterday--computer status, various times.

There are also two blogs that describe the activity life cycle more detailed than I wrote to recommend to everyone

Http://www.cnblogs.com/zyw-205520/p/3313268.html

Http://www.cnblogs.com/mengdd/archive/2012/12/01/2797784.html

Get up in the morning and yell at the top.

    

    

    

    

My Android Interview Road (III: various states)

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.