{"id":1679,"date":"2016-08-16T11:51:01","date_gmt":"2016-08-16T03:51:01","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=1679"},"modified":"2026-08-18T12:58:51","modified_gmt":"2026-08-18T04:58:51","slug":"android%e4%b9%8bhandler%e5%86%85%e5%ad%98%e6%b3%84%e6%bc%8f%e5%88%86%e6%9e%90%e5%8f%8a%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=1679","title":{"rendered":"Android\u4e4bHandler\u5185\u5b58\u6cc4\u6f0f\u5206\u6790\u53ca\u89e3\u51b3"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\">\u533f\u540d\u5185\u90e8\u7c7b <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">Handler<\/code> \u662f\u5e38\u89c1\u5199\u6cd5\uff0c\u5374\u5f88\u5bb9\u6613\u628a Activity \u9489\u6b7b\u5728\u4e3b\u7ebf\u7a0b\u6d88\u606f\u961f\u5217\u91cc\u3002Lint \u4f1a\u8b66\u544a\uff1a<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">Handler classes should be static or leaks might occur.<\/code><\/p>\n<\/blockquote>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e00\u3001\u4ecb\u7ecd<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u5148\u770b\u8fd9\u6bb5\u5f88\u5e38\u89c1\u7684\u4ee3\u7801\uff1a<\/p>\n<section style=\"display: block; background-repeat: no-repeat; width: 100%; height: 16px;\"><\/section>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">public class SampleActivity extends Activity {\n  private final Handler mLeakyHandler = new Handler() {\n    @Override\n    public void handleMessage(Message msg) {\n      \/\/ ... \n    }\n  }\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">\u5b83\u4f1a\u9020\u6210\u4e25\u91cd\u7684\u5185\u5b58\u6cc4\u6f0f\u3002\u5b9e\u9645\u7f16\u5199\u65f6\u5f80\u5f80\u4f1a\u770b\u5230\uff1a<\/p>\n<section style=\"display: block; background-repeat: no-repeat; width: 100%; height: 16px;\"><\/section>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">\u26a0 In Android, Handler classes should be static or leaks might occur.<\/code><\/pre>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e8c\u3001\u5206\u6790<\/span><\/h2>\n<h3 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em;\">1. Android \u89d2\u5ea6<\/h3>\n<p style=\"margin: 1em 0px;\">\u5e94\u7528\u542f\u52a8\u65f6\uff0cframework \u4e3a\u4e3b\u7ebf\u7a0b\u521b\u5efa\u4e00\u4e2a <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">Looper<\/code>\uff0c\u91cc\u9762\u6709\u4e00\u6761 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">Message Queue<\/code>\uff0c\u5faa\u73af\u5904\u7406\u961f\u5217\u4e2d\u7684 <a href=\"http:\/\/developer.android.com\/reference\/android\/os\/Message.html\" target=\"_blank\">\u6d88\u606f<\/a>\u3002Activity \u751f\u547d\u5468\u671f\u3001\u6309\u94ae\u70b9\u51fb\u7b49\u591a\u6570 framework \u4e8b\u4ef6\u90fd\u4f1a\u5165\u961f\u3001\u9010\u4e2a\u5904\u7406\u3002\u4e3b\u7ebf\u7a0b Looper \u4f34\u968f\u6574\u4e2a\u5e94\u7528\u751f\u547d\u5468\u671f\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u5728\u4e3b\u7ebf\u7a0b\u5b9e\u4f8b\u5316 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">Handler<\/code> \u540e\uff0c\u5b83\u4f1a\u81ea\u52a8\u4e0e\u4e3b\u7ebf\u7a0b Looper \u7684\u961f\u5217\u5173\u8054\u3002\u6bcf\u6761 Message \u90fd\u6301\u6709\u5bf9 Handler \u7684\u5f15\u7528\uff0cLooper \u5904\u7406\u65f6\u636e\u6b64\u56de\u8c03 <a href=\"http:\/\/developer.android.com\/reference\/android\/os\/Handler.html#handleMessage(android.os.Message)%E6%96%B9%E6%B3%95%E6%9D%A5%E5%A4%84%E7%90%86%E6%B6%88%E6%81%AF%E3%80%82\" target=\"_blank\">Handler#handleMessage(Message)<\/a>\u3002<\/p>\n<h3 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em;\">2. Java \u89d2\u5ea6<\/h3>\n<p style=\"margin: 1em 0px;\"><code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">\u975e\u9759\u6001\u5185\u90e8\u7c7b<\/code> \u548c <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">\u533f\u540d\u7c7b<\/code> \u90fd\u4f1a\u6f5c\u5728\u5f15\u7528\u6240\u5c5e\u5916\u90e8\u7c7b\uff1b<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">\u9759\u6001\u5185\u90e8\u7c7b<\/code> \u4e0d\u4f1a\u3002<\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e09\u3001\u6cc4\u6f0f\u6765\u6e90<\/span><\/h2>\n<section style=\"display: block; background-repeat: no-repeat; width: 100%; height: 16px;\"><\/section>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">public class SampleActivity extends Activity {\n\n  private final Handler mLeakyHandler = new Handler() {\n    @Override\n    public void handleMessage(Message msg) {\n      \/\/ ...\n    }\n  }\n\n  @Override\n  protected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n\n    \/\/ Post a message and delay its execution for 10 minutes.\n    mLeakyHandler.postDelayed(new Runnable() {\n      @Override\n      public void run() { \/* ... *\/ }\n    }, 1000 * 60 * 10);\n\n    \/\/ Go back to the previous Activity.\n    finish();\n  }\n}<\/code><\/pre>\n<p style=\"margin: 1em 0px;\">Activity <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">finish<\/code> \u4e4b\u540e\uff0c\u8fd9\u6761\u5ef6\u65f6\u6d88\u606f\u5728\u5904\u7406\u524d\u4f1a\u5728\u4e3b\u7ebf\u7a0b\u961f\u5217\u91cc\u5f85 10 \u5206\u949f\u3002\u6d88\u606f\u6301\u6709 Handler\uff0cHandler \u53c8\u6301\u6709\u5916\u90e8\u7c7b SampleActivity\u3002\u8fd9\u6761\u94fe\u4e00\u76f4\u7ef4\u6301\u5230\u6d88\u606f\u88ab\u5904\u7406\uff0c\u4ece\u800c\u963b\u6b62 Activity \u88ab\u56de\u6536\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u4e0a\u9762\u7684 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">Runnable<\/code> \u662f\u975e\u9759\u6001\u533f\u540d\u7c7b\uff0c\u540c\u6837\u6301\u6709\u5916\u90e8\u7c7b\u5f15\u7528\uff0c\u4e5f\u4f1a\u6cc4\u6f0f\u3002<\/p>\n<table style=\"border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; text-align: left; overflow: auto; display: table; overflow-wrap: break-word; word-break: break-all;\" width=\"817\">\n<thead>\n<tr>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u5f15\u7528\u8c01<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u4e3a\u4ec0\u4e48\u6d3b\u7740<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u540e\u679c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">Message \u2192 Handler<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5ef6\u65f6\u6d88\u606f\u8fd8\u5728\u4e3b\u7ebf\u7a0b\u961f\u5217<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">Handler \u4e0d\u80fd\u56de\u6536<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u975e\u9759\u6001 Handler \u2192 Activity<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5185\u90e8\u7c7b\u9690\u542b\u5916\u90e8 this<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">Activity \u6cc4\u6f0f<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u533f\u540d Runnable \u2192 Activity<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u540c\u6837\u662f\u975e\u9759\u6001\u533f\u540d\u7c7b<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5373\u4f7f Handler \u4fee\u597d\uff0cRunnable \u4ecd\u53ef\u80fd\u9489\u4f4f\u9875\u9762<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u56db\u3001\u6cc4\u6f0f\u89e3\u51b3\u65b9\u6848<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u6765\u6e90\u5df2\u7ecf\u660e\u786e\uff1a<\/p>\n<ol style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: decimal;\">\n<li>\n<section>\u672a\u5904\u7406\u7684\u6d88\u606f\u5f15\u7528 Handler\uff0c\u975e\u9759\u6001 Handler \u518d\u5f15\u7528 Activity\uff0c\u9875\u9762\u65e0\u6cd5\u56de\u6536\u3002<\/section>\n<\/li>\n<li>\n<section>\u975e\u9759\u6001\u533f\u540d Runnable \u540c\u6837\u5f15\u7528\u5916\u90e8\u7c7b\u3002<\/section>\n<\/li>\n<\/ol>\n<p style=\"margin: 1em 0px;\">\u8981\u70b9\uff1a<code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; font-size: 0.9em; overflow-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0px 2px; color: #ef7060; background-color: rgba(27, 31, 35, 0.05); word-break: break-all;\">\u9759\u6001\u5185\u90e8\u7c7b\u4e0d\u4f1a\u6301\u6709\u5916\u90e8\u7c7b\u5f15\u7528<\/code>\u3002\u53ef\u4ee5\u628a Handler \u653e\u5230\u5355\u72ec\u6587\u4ef6\uff0c\u6216\u5199\u6210\u9759\u6001\u5185\u90e8\u7c7b\u3002\u82e5\u8981\u5728 Handler \u91cc\u8c03 Activity\uff0c\u7528\u5f31\u5f15\u7528\u6307\u5411\u5b83\uff0c\u540c\u6837\u4e0d\u4f1a\u6cc4\u6f0f\u3002\u533f\u540d Runnable \u4e5f\u6539\u6210\u9759\u6001\u5b57\u6bb5\u4e0a\u7684\u533f\u540d\u7c7b\uff1a\u9759\u6001\u4e0a\u4e0b\u6587\u91cc\u7684\u533f\u540d\u7c7b\u4e0d\u6301\u6709\u5916\u90e8\u5b9e\u4f8b\u3002<\/p>\n<section style=\"display: block; background-repeat: no-repeat; width: 100%; height: 16px;\"><\/section>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 10px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 10px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; margin: 0.5em; padding: 3px 5px; overflow-x: auto; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">public class SampleActivity extends Activity {\n\n  \/**\n   * Instances of static inner classes do not hold an implicit\n   * reference to their outer class.\n   *\/\n  private static class MyHandler extends Handler {\n    private final WeakReference&lt;SampleActivity&gt; mActivity;\n\n    public MyHandler(SampleActivity activity) {\n      mActivity = new WeakReference&lt;SampleActivity&gt;(activity);\n    }\n\n    @Override\n    public void handleMessage(Message msg) {\n      SampleActivity activity = mActivity.get();\n      if (activity != null) {\n        \/\/ ...\n      }\n    }\n  }\n\n  private final MyHandler mHandler = new MyHandler(this);\n\n  \/**\n   * Instances of anonymous classes do not hold an implicit\n   * reference to their outer class when they are \"static\".\n   *\/\n  private static final Runnable sRunnable = new Runnable() {\n      @Override\n      public void run() { \/* ... *\/ }\n  };\n\n  @Override\n  protected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n\n    \/\/ Post a message and delay its execution for 10 minutes.\n    mHandler.postDelayed(sRunnable, 1000 * 60 * 10);\n\n    \/\/ Go back to the previous Activity.\n    finish();\n  }\n}<\/code><\/pre>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e94\u3001\u5c0f\u7ed3<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u9759\u6001\u4e0e\u975e\u9759\u6001\u5185\u90e8\u7c7b\u5dee\u522b\u4e0d\u5927\uff0c\u4f46 Android \u91cc\u5fc5\u987b\u5206\u6e05\uff1a\u82e5\u5185\u90e8\u7c7b\u5b9e\u4f8b\u751f\u547d\u5468\u671f\u53ef\u80fd\u6bd4 Activity \u66f4\u957f\uff0c\u4e0d\u8981\u7528\u975e\u9759\u6001\u5185\u90e8\u7c7b\u3002\u66f4\u597d\u7684\u505a\u6cd5\u662f\u9759\u6001\u5185\u90e8\u7c7b + \u5f31\u5f15\u7528\u6307\u5411 Activity\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u539f\u6587\u94fe\u63a5\uff1ahttp:\/\/www.jianshu.com\/p\/cb9b4b71a820<\/p>\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\"><strong>\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a\u5ef6\u65f6 Message \u4f1a\u6293\u4f4f Handler\uff0c\u975e\u9759\u6001 Handler\/Runnable \u518d\u6293\u4f4f Activity\uff1b\u6539\u6210\u9759\u6001\u5185\u90e8\u7c7b\u52a0 WeakReference\uff0c\u6cc4\u6f0f\u94fe\u5c31\u65ad\u4e86\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u533f\u540d\u5185\u90e8\u7c7b Handler \u662f\u5e38\u89c1\u5199\u6cd5\uff0c\u5374\u5f88\u5bb9\u6613\u628a Activity \u9489\u6b7b\u5728\u4e3b\u7ebf\u7a0b\u6d88\u606f\u961f\u5217\u91cc\u3002Lint \u4f1a\u8b66\u544a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[45],"tags":[196,77],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/1679"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1679"}],"version-history":[{"count":1,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/1679\/revisions"}],"predecessor-version":[{"id":1680,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/1679\/revisions\/1680"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}