{"id":186739,"date":"2020-10-19T07:37:03","date_gmt":"2020-10-18T23:37:03","guid":{"rendered":"http:\/\/4563.org\/?p=186739"},"modified":"2020-10-19T07:37:03","modified_gmt":"2020-10-18T23:37:03","slug":"%e8%af%b7%e6%95%99%e4%b8%80%e4%b8%aa-android-%e7%94%9f%e5%91%bd%e5%91%a8%e6%9c%9f%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=186739","title":{"rendered":"\u8bf7\u6559\u4e00\u4e2a android \u751f\u547d\u5468\u671f\u7684\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8bf7\u6559\u4e00\u4e2a android \u751f\u547d\u5468\u671f\u7684\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qwertyegg <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>app \u6709\u4e00\u4e2a\u95e8\u5e18 ActivityOne,\u4f1a\u8fdb\u884c\u4e00\u4e9b\u521d\u59cb\u5316\u5de5\u4f5c\uff0c\u5b8c\u6210\u540e\u4f1a\u8fdb\u5165 app \u7684\u4e3b\u8981 Activity\uff0c\u540d\u53eb ActivityTwo<\/p>\n<p>\u5982\u679c\u5728\u8fd9\u65f6\uff0c\u628a\u7a0b\u5e8f\u653e\u5165\u540e\u53f0\uff0c\u957f\u65f6\u95f4\u7684\u4f11\u7720\u540e\uff0c\u56de\u5230\u8fd9\u4e2a app\uff0c\u4f1a\u56de\u5230 ActivityTwo<\/p>\n<p>\u5728\u6b64\u65f6\u5982\u679c\u6211\u7528\u540e\u9000\u952e\uff0c\u4f1a\u56de\u5230 ActivityOne<\/p>\n<p>\u6211\u7684\u95ee\u9898\u662f\uff0c\u56e0\u4e3a\u957f\u65f6\u95f4\u4f11\u7720\uff0cActivityOne \u4f1a\u518d\u6b21\u8c03\u7528 onCreate()\uff0c\u6211\u7684\u7406\u89e3\u662f ActivityOne \u56e0\u4e3a\u4f11\u7720\u88ab\u7cfb\u7edf\u5e72\u6389\u4e86\u3002\u6211\u6709\u4e00\u6bb5\u521d\u59cb\u5316\u7684\u4ee3\u7801\uff0c\u662f\u5728 ActivityOne \u7684 onCreate()\u91cc\u9762\u8fd0\u884c\u7684\uff0c\u53ef\u662f\u5f88\u663e\u7136\uff0c\u6211\u5e76\u4e0d\u5e0c\u671b\u5728 app \u4ece\u540e\u53f0\u5524\u9192\u540e\u518d\u6b21\u8fd0\u884c\u8fd9\u6bb5\u521d\u59cb\u5316\u7684\u4ee3\u7801<\/p>\n<p>\u6211\u8be5\u600e\u4e48\u529e\u5462\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4034805\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : qwertyegg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u67e5\u4e86\u4e0b\u8d44\u6599\uff0c\u662f\u4e0d\u662f\u6211\u5728 onCreate()\u91cc\u9762\u68c0\u67e5 savedInstanceState != null \u5c31\u53ef\u4ee5\u5224\u65ad\u8fd9\u4e2a ActivityOne \u662f\u88ab\u7cfb\u7edf\u9500\u6bc1\u540e\u91cd\u65b0\u9020\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4034806\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : MaL <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             ActivityOne \u7528\u4e0d\u5230\u4e86\uff0c\u4e0d\u8c03 finish()\u4e48\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4034807\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hikari2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ec0\u4e48\u624b\u673a\uff0c\u6709\u7684\u624b\u673a\u542f\u52a8\u7a0b\u5e8f\u7684\u65f6\u5019\u53ea\u542f\u52a8\u4f60\u7684\u7a0b\u5e8f\uff0c\u7136\u540e\u4f60\u7684\u7a0b\u5e8f\u6839\u636e\u4f60\u7684 manifest \u542f\u52a8\u4f60\u7684 LAUNCHER Activity\uff0c\u6709\u7684\u624b\u673a\u4f1a\u627e\u5230\u4f60\u7684\u7a0b\u5e8f\u7684 LAUNCHER Activity\uff0c\u7136\u540e\u542f\u52a8\u4f60\u7684 activity\uff0c\u8fd9\u4e24\u4e2a\u4ece\u73b0\u8c61\u4e0a\u6ca1\u4ec0\u4e48\u533a\u522b\u3002\u8fd9\u4e2a\u662f\u6211\u6ee1\u6ee1\u6478\u7d22\u53d1\u73b0\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4034808\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kiroter <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             finish                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4034809\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : qwertyegg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @MaL <br \/>@kiroter <\/p>\n<p>\u8c22\u8c22\u56de\u590d\uff0cActivityOne \u5e76\u975e\u7528\u4e0d\u5230\uff0c\u56e0\u4e3a\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u4ece ActivityOne \u5207\u6362\u5230 ActivityTwo \u540e\uff0c\u5e0c\u671b ActivityOne \u4f1a\u5728 Activity Stack \u4e0a(\u4e0d\u77e5\u9053\u8fd9\u4e48\u8bf4\u5bf9\u4e0d\u5bf9)\u3002\u8fd9\u65f6\u53ef\u4ee5\u6309 back \u952e\u56de\u5230 ActivityOne.\u800c\u4ece\u7761\u7720\u4e2d\u5524\u9192\u540e(\u6b64\u65f6\u5728 ActivityTwo)\uff0c\u6309\u4e86 back \u952e\u4e5f\u4f1a\u56de\u5230 ActivityOne\uff0c\u4f46\u662f\u89c2\u5bdf\u5230 ActivityOne \u5df2\u7ecf\u88ab\u7cfb\u7edf\u9500\u6bc1\uff0c\u6240\u4ee5\u4f1a\u91cd\u65b0\u8c03\u7528 onCreate()\u3002<\/p>\n<p>\u6211\u67e5\u5230\u7684\u529e\u6cd5\u662f\u7528 savedInstanceState != null \u662f\u5426\u88ab\u7cfb\u7edf\u9500\u6bc1\uff0c\u7136\u540e\u5728 onCreate()\u91cc\u9762\u5224\u65ad\u662f\u5426\u91cd\u65b0\u521d\u59cb\u5316\u3002finish()\u6309\u7167\u5f00\u53d1\u6587\u6863\u8bf4\u6cd5\u662f\u4e0d\u9700\u8981 ActivityOne\uff0c\u9700\u8981\u5c06\u5176\u5173\u95ed\u7684\u65f6\u5019\u8c03\u7528\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4034810\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : qwertyegg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hikari2 \u8c22\u8c22\u6307\u5bfc\uff0c\u624b\u673a\u662f pixel 3a\uff0c\u6211\u7684\u95ee\u9898\u4e0d\u5728\u4e8e\u542f\u52a8\u7a0b\u5e8f\uff0c\u800c\u662f\u8ff7\u60d1\u4e8e\u7a0b\u5e8f\u5728\u540e\u53f0\u88ab\u5524\u9192\u540e(\u8fd8\u88ab\u6740\u4e86 Activity)\u7684\u884c\u4e3a\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4034811\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : devfeng <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u60f3\u4e0d\u5230\u8fd9\u662f\u5565\u573a\u666f\u3002\u4f60 back \u56de\u5230 activityone\uff0c\u518d\u81ea\u52a8\u8df3\u5230 activitytwo \u5417                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4034812\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : qwertyegg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @devfeng \u90a3\u6bb5\u521d\u59cb\u5316\u4ee3\u7801\u4f1a\u81ea\u52a8\u8df3\u5230 ActivityTwo \u3002\u5f53\u6211\u7528 back \u6309\u952e\u4ece ActivityTwo \u56de\u5230 ActivityOne \u7684\u65f6\u5019\uff0c\u5e76\u4e0d\u60f3\u91cd\u65b0\u521d\u59cb\u5316                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4034813\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : whenwind <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Activity \u6700\u597d\u4e0d\u8981\u4f5c\u4e3a\u6d41\u7a0b\u7684\u63a7\u5236\u548c\u8bb0\u5f55\u6765\u4f7f\u7528\uff0c\u56e0\u4e3a\u4f60\u6c38\u8fdc\u4e0d\u77e5\u9053\u7cfb\u7edf\u4f1a\u5728\u4ec0\u4e48\u65f6\u5019\u7ed9\u4f60\u6740\u6389\u3002<br \/>\u5982\u679c\u6709\u9700\u8981\u7528\u5230\u7c7b\u4f3c\u8df3\u8fc7 ActivityOne \u76f4\u8fbe ActivityTwo \u7684\u8bdd\u6211\u4f1a\u7528 Service\uff0cActivity \u7684\u884c\u4e3a\u4ee5 Service \u4e0a\u50a8\u5b58\u7684\u6570\u636e\u4e3a\u51c6\uff0cActivityOne \u5728\u8be2\u95ee Service \u5df2\u7ecf\u521d\u59cb\u5316\u8fc7\u4e86\u5c31\u4e0d\u6267\u884c\u521d\u59cb\u5316\u4ee3\u7801\u76f4\u63a5\u8fdb\u5165 ActivityTwo\uff0c\u4f11\u7720\u56de\u6765 ActivityTwo \u6309\u4e0b\u8fd4\u56de\u952e\u8be2\u95ee Service\uff0c\u5982\u679c\u5df2\u7ecf\u6267\u884c\u8fc7\u521d\u59cb\u5316\u5c31\u4e0d\u6267\u884c\u8fd4\u56de\u3002<br \/>\u5982\u679c\u4e0d\u5e0c\u671b\u4f7f\u7528 Service \u7684\u8bdd\u90a3\u628a\u90e8\u5206\u521d\u59cb\u5316\u4ee3\u7801\u653e\u5728 ActivityTwo \u7684 onCreate \u5462\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4034814\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : demo06 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u5728 1 \u91cc\u9762\u8df3\u8f6c \u4ee3\u7801\u540e\u9762\u52a0\u4e2a finish(),\u8c8c\u4f3c 2 \u5c31\u4e0d\u4f1a\u518d\u8fd4\u56de 1 \u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u6559\u4e00\u4e2a android \u751f\u547d\u5468\u671f&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/186739"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=186739"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/186739\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=186739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=186739"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=186739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}