{"id":75,"date":"2015-08-05T05:55:34","date_gmt":"2015-08-05T05:55:34","guid":{"rendered":"https:\/\/boochlin.com\/?p=75"},"modified":"2016-07-13T14:35:00","modified_gmt":"2016-07-13T14:35:00","slug":"android-home-screen-life-cycle","status":"publish","type":"post","link":"https:\/\/boochlin.com\/?p=75","title":{"rendered":"Android home screen life cycle."},"content":{"rendered":"<p>\u4e00\u822c\u7684activity life cycle \u00a0\u5927\u6982\u7db2\u8def\u4e0a\u5df2\u7d93\u63d0\u5230\u721b\u6389\u4e86<br \/>\n\u60f3\u7576\u7136\u4e0d\u6703\u8ddf\u8005\u6dcc\u9019\u500b\u6df7\u6c34\uff0c\u4e0d\u904e\u9084\u662f\u8981\u5148\u6709\u57fa\u672c\u7684life cycle \u89c0\u5ff5<br \/>\n\u9019\u6b21\u8981\u63d0\u7684\u662f <span style=\"color: #0000ff;\"><strong>Home Screen Life cycle.<\/strong><\/span><\/p>\n<p><!--more--><\/p>\n<p><a href=\"http:\/\/developer.android.com\/training\/basics\/activity-lifecycle\/starting.html\" target=\"_blank\">activity life cycle<\/a><br \/>\n\u5404\u4f4d\u5148\u611f\u53d7\u611f\u53d7\uff0c<br \/>\n\u9019\u662f\u4e00\u822c\u7684\u60c5\u6cc1<br \/>\n<img decoding=\"async\" src=\"http:\/\/developer.android.com\/images\/training\/basics\/basic-lifecycle.png\" alt=\"activity flow\" \/><\/p>\n<p>\u4f7f\u7528ap1 \u4e2d\uff0c\u5207\u63db\u5230 \u00a0ap2 \u6b63\u5e38\u4f86\u8aaa\u6703\u662f<br \/>\n<img decoding=\"async\" src=\"http:\/\/developer.android.com\/images\/training\/basics\/basic-lifecycle-paused.png\" alt=\"\" \/><\/p>\n<h4><span style=\"color: #0000ff;\"><strong>ap1 \u00a0\u9032\u5165 \u00a0onPause &#8212;-&gt; \u00a0ap2 \u00a0\u9032\u5165 onResume<\/strong><\/span><\/h4>\n<p>&nbsp;<\/p>\n<p>\u7e7c\u7e8c\u5ef6\u4f38\u4f86\u601d\u8003\uff0c\u6309\u4e86home button \u6703\u767c\u751f\u600e\u6a23\u7684\u72c0\u614b\u5207\u63db<\/p>\n<h4><strong><span style=\"color: #0000ff;\">ap1 \u00a0\u9032\u5165 \u00a0onPause &#8212;-&gt; home ap \u00a0\u9032\u5165 onResume.<\/span><\/strong><\/h4>\n<p>home ap \u00a0\u4e5f\u662f\u4e00\u7a2eapplication \u6240\u4ee5\u7576\u7136\u4e5f\u7b26\u5408\u9019\u500b\u751f\u547d\u9031\u671f<br \/>\nhome button \u53ea\u662f\u63d0\u4f9b\u4e00\u7a2e\u9032\u5165home screen\u7684\u624b\u6cd5<br \/>\n\u9700\u8981\u88dc\u5145\u7684\u662f home button \u5207\u5230 home screen \u7684\u60c5\u6cc1<br \/>\n<span style=\"color: #ff0000;\">\u6703\u591a\u9032\u5165\u4e00\u500b onNewIntent \u7684\u72c0\u614b\uff0c\u6240\u4ee5\u8981\u7279\u5225\u8655\u7406 home button event<\/span><br \/>\n<span style=\"color: #ff0000;\"> \u5247\u662f\u5728\u9019\u4f5c\u624b\u8173<\/span><\/p>\n<h4>\u628ahome button \u88dc\u5b8c<br \/>\n<strong><span style=\"color: #0000ff;\">ap1 \u9032\u5165 onPause &#8212;&#8211;&gt; home ap \u9032\u5165 onNewIntent &#8212;&#8211;&gt; home ap \u9032\u5165 onResume<\/span><\/strong><\/h4>\n<p>\u597d\u4e86\uff0c\u7b2c\u4e00\u968e\u6bb5 home button left cycle \u641e\u5b9a<\/p>\n<p>\u63a5\u4e0b\u4f86\u8acb\u601d\u8003\u4e00\u4e0b,onResume \u548c onPause \u72c0\u614b\u5dee\u5728\u54ea\u88e1<br \/>\n\u4e3b\u8981\u5728\u65bc ap view \u662f\u5426\u986f\u793a\u5728foreground\uff0c<br \/>\nonResume \u662fview \u986f\u793a\u5728foreground<br \/>\nonPause \u662f view \u4e0d\u986f\u793a\u5728foreground<\/p>\n<h4>\u7b2c\u4e8c\u500b\u554f\u984c\u662f<\/h4>\n<p>home screen \u5df2\u7d93\u5728onResume \u968e\u6bb5\uff0c\u986f\u793a\u5728 foreground<br \/>\n\u9019\u6642\u5019 click home button \u6703\u767c\u751f\u4f55\u4e8b\uff1f<\/p>\n<h4><span style=\"color: #0000ff;\">home ap \u9032\u5165 onPause &#8211;&gt; home ap \u9032\u5165 onNewIntent &#8211;&gt; home ap \u9032\u5165 onreusme<\/span><\/h4>\n<p><span style=\"color: #0000ff;\">\u7d50\u8ad6\u662f home screen \u81ea\u5df1\u73a9\u81ea\u5df1\u7684\u90a3\u4e00\u5957<\/span><br \/>\n<span style=\"color: #0000ff;\"> \u4e00\u4eba\u5206\u98fe\u5169\u89d2 \u81ea\u5df1\u77ac\u9593 \u6d88\u5931 \u518d\u51fa\u73fe<\/span><\/p>\n<p><span style=\"color: #ff0000;\">\u6703\u63d0\u5230\u9019\u500b\uff0c\u4e3b\u8981\u662f\u63d0\u9192\u767c\u767chome screen ap \u8655\u7406home button event<\/span><br \/>\n<span style=\"color: #ff0000;\"> \u4e5f\u8981\u540c\u6642\u8003\u616e onPause \u548c onresume \u7684\u89f8\u767c\u95dc\u4fc2\uff0c\u800c\u4e0d\u80fd\u55ae\u7d14\u8003\u616e onNewIntent \u7684 handle.<\/span><br \/>\n<span style=\"color: #ff0000;\"> \u7b97\u662fhome screen\u7684\u7279\u6b8a\u6848\u4f8b\uff0c\u8207\u4e00\u822c ap \u4e0d\u540c\u7684\u5730\u65b9<\/span><br \/>\n<span style=\"color: #ff0000;\"> \u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u822c\u7684activity life cycle \u00a0\u5927\u6982\u7db2\u8def\u4e0a\u5df2\u7d93\u63d0\u5230\u721b\u6389\u4e86 \u60f3\u7576\u7136\u4e0d\u6703\u8ddf\u8005\u6dcc\u9019\u500b\u6df7\u6c34\uff0c\u4e0d\u904e\u9084\u662f\u8981\u5148\u6709\u57fa\u672c\u7684life cycle \u89c0\u5ff5 \u9019\u6b21\u8981\u63d0\u7684\u662f Home Screen Life cy&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50],"tags":[12,9,13],"_links":{"self":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/75"}],"collection":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=75"}],"version-history":[{"count":0,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/75\/revisions"}],"wp:attachment":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}