{"id":14,"date":"2015-02-14T14:53:27","date_gmt":"2015-02-14T14:53:27","guid":{"rendered":"https:\/\/boochlin.com\/?p=14"},"modified":"2015-03-30T02:00:46","modified_gmt":"2015-03-30T02:00:46","slug":"fmradio-%e9%96%8b%e7%99%bc%e7%ad%86%e8%a8%98-%ef%bc%88%e5%9b%9b%ef%bc%89-alteractivity","status":"publish","type":"post","link":"https:\/\/boochlin.com\/?p=14","title":{"rendered":"FMRadio \u958b\u767c\u7b46\u8a18 \uff08\u56db\uff09- AlterActivity"},"content":{"rendered":"<h2>AlterActivity.java<\/h2>\n<p>\u6b64\u7a0b\u5f0f\u4e3b\u8981\u7576\u4f7f\u7528\u8005\u62d4\u6389\u8033\u6a5f\u5f8c\uff0c\u6703\u8df3\u51fa\u4e00\u500b\u8996\u7a97\u544a\u8a34\u4f7f\u7528\u8005\uff0c\u8acb\u63d2\u56de\u8033\u6a5f\uff0c\u4e0d\u7136\u5c31\u8981\u95dc\u6389FMRadio\u3002<\/p>\n<p>\u96d6\u7136\u9019\u6bb5\u7a0b\u5f0f\u633a\u77ed\u7684.\u4f46\u662f\u975e\u5e38\u7cbe\u83ef\u963f<\/p>\n<p>\u958b\u982d\u7b2c\u4e00\u53e5\u8a71\u5c31\u89e3\u91cb\u4e86\u4e00\u5207<\/p>\n<p>\/** AlertActivity: use as a dialog, since Service cannot pop up a dialog *\/<\/p>\n<p>\u9019\u662f\u500b\u554f\u984c<\/p>\n<p><!--more--><\/p>\n<p>\u539f\u56e0<\/p>\n<p>\u7576\u6211\u5011\u5229\u7528Service \u53bb\u63a5\u53d7\u7cfb\u7d71\u50b3\u4f86\u7684\u8a0a\u606f\u2026\u4f46\u7531\u65bcservice\u4e26\u6c92\u6709\u5c0d\u5176\u4ed6activity\u9032\u884c\u756b\u9762\u8b8a\u66f4\u7684\u529f\u80fd\u2026\u9019\u4e5f\u662fandroid \u5c0d\u65bcservice\u6240\u4f5c\u7684\u9650\u5236<\/p>\n<p>\u4e5f\u53ef\u4ee5\u8f49\u5316\u6210<\/p>\n<p>\/*\u5728\u754c\u9762\u4e0a\u6dfb\u52a0\u4e00\u4e2aVIEW\uff0c\u4f46\u662f\u8fd9\u4e2a\u7a97\u53e3\u4e0d\u60f3\u4f9d\u9644\u4efb\u4f55\u4e00\u4e2aactivity*\/<\/p>\n<p>\u6709\u4ee5\u4e0b\u5e7e\u500b\u89e3\u6c7a\u65b9\u6848<\/p>\n<p>A1:<\/p>\n<p>\u4e3b\u8981\u4f86\u8aaaservice\u4e26\u6c92\u6709context\u53bb\u53d6\u5f97view<\/p>\n<p>\u90a3\u6216\u8a31\u53ef\u4ee5\u8aaa\u2026\u90a3\u7576\u8981\u986f\u793adialog\u6642\u2026\u6211\u5c31\u50b3\u5165\u4e00\u500bcontext<\/p>\n<p>\u4f46\u662fservice\u63a5\u6536\u5230\u7cfb\u7d71\u8a0a\u606f\u6642\uff08hdmi,usb,phone call\uff09\u4e26\u7121\u6cd5\u78ba\u8a8d\u81ea\u5df1\u76ee\u524d\u518dmainthread\u7684activity\u662f\u54ea\u4e00\u500b<\/p>\n<p>\u90a3\u6211\u5011\u4e7e\u8106\u5c31\u4e0d\u7ba1\u662f\u54ea\u4e00\u500bactivity\u518d\u8dd1<\/p>\n<h3>\u76f4\u63a5\u53bb\u53d6\u5f97<b>WindowManager<\/b><b>,ViewManager\u4e0d\u5c31\u597d\u4e86<\/b><\/h3>\n<p>\u7684\u7136\u5f8c\u6dfb\u52a0\u4e00\u500bdialog view<\/p>\n<p><a href=\"http:\/\/developer.android.com\/reference\/android\/view\/WindowManager.html\">http:\/\/developer.android.com\/reference\/android\/view\/WindowManager.html<\/a><\/p>\n<p><a href=\"http:\/\/developer.android.com\/reference\/android\/view\/ViewManager.html#addView(android.view.View,%20android.view.ViewGroup.LayoutParams)\">http:\/\/developer.android.com\/reference\/android\/view\/ViewManager.html#addView(android.view.View, android.view.ViewGroup.LayoutParams)<\/a><\/p>\n<p>window view manger<\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/xieqibao\/article\/details\/6567814\">http:\/\/blog.csdn.net\/xieqibao\/article\/details\/6567814<\/a><\/p>\n<p><a href=\"http:\/\/disanji.net\/2011\/08\/31\/android-%E4%B9%8B-window%E3%80%81windowmanager-%E4%B8%8E%E7%AA%97%E5%8F%A3%E7%AE%A1%E7%90%86\/\">http:\/\/disanji.net\/2011\/08\/31\/android-%E4%B9%8B-window%E3%80%81windowmanager-%E4%B8%8E%E7%AA%97%E5%8F%A3%E7%AE%A1%E7%90%86\/<\/a><\/p>\n<p><strong><strong>\u00a0<\/strong><\/strong><\/p>\n<p>code implement:<\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/fengqiaoyebo2008\/article\/details\/6309676\">http:\/\/blog.csdn.net\/fengqiaoyebo2008\/article\/details\/6309676<\/a><\/p>\n<p><strong><strong>\u00a0<\/strong><\/strong><\/p>\n<p>A2:<\/p>\n<p>\u5982\u679c\u4e0d\u50b3\u4e00\u500bcontext\u7d66\u6211\u2026\u90a3\u9ebc\u555f\u52d5\u4e00\u500b\u65b0\u7684activity\u9577\u7684\u8ddfdialog\u5f88\u50cf\u4e0d\u5c31\u597d\u4e86<\/p>\n<p>FMRadio2\u7684\u5be6\u4f5c\u65b9\u6cd5\u5c31\u662f\u9019\u6a23<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u90e8\u4efd\u5728\u65bc\u555f\u52d5\u65b9\u6cd5<\/p>\n<pre>Intent startIntent = new Intent(this, AlertActivity.class);\r\n\r\nstartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r\n<\/pre>\n<p><strong><strong>\u00a0<\/strong><\/strong><\/p>\n<pre>&lt;activity\r\n\r\nandroid:name=\".AlertActivity\"\r\n\r\nandroid:theme=\"@style\/Theme.AlertDialog\" &gt;\r\n\r\n&lt;intent-filter&gt;\r\n\r\n    &lt;action android:name=\"toActivity\" \/&gt;\r\n\r\n    &lt;category android:name=\"android.intent.category.DEFAULT\" \/&gt;\r\n\r\n&lt;\/intent-filter&gt;\r\n\r\n&lt;\/activity&gt;\r\n<\/pre>\n<p>A3:<\/p>\n<p>\u4fee\u6539\u5efa\u7acb\u7684Dialog\u5c6c\u6027LayoutParams<\/p>\n<pre>WindowManager.LayoutParams.TYPE_SYSTEM_ALERT\r\n<\/pre>\n<p><a href=\"http:\/\/hi.baidu.com\/lphack\/item\/1879eb8a614c9659840fabc4\">http:\/\/hi.baidu.com\/lphack\/item\/1879eb8a614c9659840fabc4<\/a><\/p>\n<p><a href=\"http:\/\/www.dotblogs.com.tw\/merlin\/archive\/2012\/04\/13\/71480.aspx\">http:\/\/www.dotblogs.com.tw\/merlin\/archive\/2012\/04\/13\/71480.aspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>AlterActivity.java \u6b64\u7a0b\u5f0f\u4e3b\u8981\u7576\u4f7f\u7528\u8005\u62d4\u6389\u8033\u6a5f\u5f8c\uff0c\u6703\u8df3\u51fa\u4e00\u500b\u8996\u7a97\u544a\u8a34\u4f7f\u7528\u8005\uff0c\u8acb\u63d2\u56de\u8033\u6a5f\uff0c\u4e0d\u7136\u5c31\u8981\u95dc\u6389FMRadio\u3002 \u96d6\u7136\u9019\u6bb5\u7a0b\u5f0f\u633a\u77ed\u7684.\u4f46\u662f\u975e\u5e38\u7cbe\u83ef\u963f \u958b\u982d\u7b2c\u4e00\u53e5\u8a71\u5c31\u89e3\u91cb\u4e86\u4e00\u5207 \/&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[46],"_links":{"self":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/14"}],"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=14"}],"version-history":[{"count":0,"href":"https:\/\/boochlin.com\/index.php?rest_route=\/wp\/v2\/posts\/14\/revisions"}],"wp:attachment":[{"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boochlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}