{"id":1226,"date":"2011-07-12T13:39:00","date_gmt":"2011-07-12T13:39:00","guid":{"rendered":"https:\/\/rawbytes.org\/?p=1226"},"modified":"2025-11-24T03:00:17","modified_gmt":"2025-11-24T03:00:17","slug":"%e5%a4%96%e9%83%a8%e3%81%aeactivity%e3%82%92%e6%98%8e%e7%a4%ba%e7%9a%84intent%e3%81%a7%e9%96%8b%e5%a7%8b%e3%81%99%e3%82%8b%e3%82%84%e3%82%8a%e3%81%8b%e3%81%9f%e3%81%ae%e8%a6%81%e7%82%b9%e3%81%a0","status":"publish","type":"post","link":"https:\/\/rawbytes.org\/?p=1226","title":{"rendered":"\u5916\u90e8\u306eActivity\u3092\u660e\u793a\u7684Intent\u3067\u958b\u59cb\u3059\u308b\u3084\u308a\u304b\u305f\u306e\u8981\u70b9\u3060\u3051"},"content":{"rendered":"<p>Android\u30a2\u30d7\u30ea\u306e\u958b\u767a\u3067\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u304a\u3088\u3073Activity\u540d\u304c\u5206\u304b\u3063\u3066\u3044\u308b\u30a2\u30d7\u30ea\u3092\u3001\u81ea\u5206\u306e\u30a2\u30d7\u30ea\u304b\u3089\u8d77\u52d5\u3057\u305f\u3044\u6642\u304c\u3042\u308b\u3002\u305f\u3068\u3048\u3070\u30d7\u30ea\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306eGoogle\u88fd\u30a2\u30d7\u30ea\u3068\u304b\u3002<\/p>\n<p>\u3053\u306e\u5834\u5408\u3082\u3001\u81ea\u30d1\u30c3\u30b1\u30fc\u30b8\u5185\u306e\u660e\u793a\u7684\u30a4\u30f3\u30c6\u30f3\u30c8\u3068\u540c\u69d8\u306b\u8d77\u52d5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u5177\u4f53\u7684\u306b\u306f\u4ee5\u4e0b\u307f\u305f\u3044\u306b\u3059\u308b\u3002<\/p>\n<p>Intent i = new Intent();<br \/>\ni.setAction(Intent.ACTION_MAIN);<br \/>\ni.setClassName(&#8220;com.example.external.package&#8221;, &#8220;com.example.external.package.SomeActivity&#8221;);<br \/>\n\/\/i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); \/\/\u5916\u90e8Activity\u3092\u81ea\u5206\u306eActivity\u30b9\u30bf\u30c3\u30af\u3068\u306f\u5225\u306b\u7acb\u3066\u305f\u3044\u3068\u304d\u3002<br \/>\nstartActivity(i);<\/p>\n<p>\u6ce8\u610f\u70b9\u3068\u3057\u3066\u3001setClassName(String packageName, String ActivityName)\u3059\u308b\u3068\u304d\u306b\u3001ActivityName\u5074\u3082\u30d5\u30eb\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u3067\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3053\u3068\u3002\u3053\u308c\u3092\u3057\u306a\u3044\u3068ClassNotFoundException\u306b\u306a\u308b\u3002<\/p>\n<p>\u3042\u3068\u3001setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)\u3057\u306a\u3044\u3068\u3001\u4f8b\u3048\u3070\u8d77\u52d5\u3057\u305f\u30a2\u30d7\u30ea\u3092HOME\u30dc\u30bf\u30f3\u3067\u7d42\u4e86\u3057\u305f\u5f8c\u306b\u3082\u3046\u4e00\u56de\u81ea\u5206\u306e\u30a2\u30d7\u30ea\u3092\u7acb\u3061\u4e0a\u3052\u305f\u6642\u3001\u81ea\u5206\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u304b\u3089\u8d77\u52d5\u3057\u305fSomeActivity\u306e\u65b9\u306e\u753b\u9762\u304c\u51fa\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u4e8b\u306b\u306a\u308b\u3002\u3053\u308c\u3092\u907f\u3051\u308b\u306b\u306fIntent.FLAG_ACTIVITY_NEW_TASK\u30d5\u30e9\u30b0\u3092\u6307\u5b9a\u3057\u305f\u72b6\u614b\u3067startActivity()\u3059\u308b\u3002<\/p>\n<p>\u3053\u306e\u3078\u3093\u306fTASK\u306b\u3064\u3044\u3066\u6574\u7406\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u305d\u3046\u3060\u3051\u3069\u3001\u5225\u306e\u6a5f\u4f1a\u306b\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android\u30a2\u30d7\u30ea\u306e\u958b\u767a\u3067\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u304a\u3088\u3073Activity\u540d\u304c\u5206\u304b\u3063\u3066\u3044\u308b\u30a2\u30d7\u30ea\u3092\u3001\u81ea\u5206\u306e\u30a2\u30d7\u30ea\u304b\u3089\u8d77\u52d5\u3057\u305f\u3044\u6642\u304c\u3042\u308b\u3002\u305f\u3068\u3048\u3070\u30d7\u30ea\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306eGoogle\u88fd\u30a2\u30d7\u30ea\u3068\u304b\u3002 \u3053\u306e\u5834\u5408\u3082\u3001\u81ea\u30d1\u30c3\u30b1\u30fc\u30b8\u5185\u306e\u660e\u793a\u7684\u30a4\u30f3\u30c6\u30f3\u30c8\u3068\u540c\u69d8\u306b\u8d77\u52d5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u5177\u4f53\u7684\u306b\u306f\u4ee5\u4e0b\u307f\u305f\u3044\u306b\u3059\u308b\u3002 Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.setClassName(&#8220;com.example.external.package&#8221;, &#8220;com.example.external.package.SomeActivity&#8221;); \/\/i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); \/\/\u5916\u90e8Activity\u3092\u81ea\u5206\u306eActivity\u30b9\u30bf\u30c3\u30af\u3068\u306f\u5225\u306b\u7acb\u3066\u305f\u3044\u3068\u304d\u3002 startActivity(i); \u6ce8\u610f\u70b9\u3068\u3057\u3066\u3001setClassName(String packageName, String ActivityName)\u3059\u308b\u3068\u304d\u306b\u3001ActivityName\u5074\u3082\u30d5\u30eb\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u3067\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3053\u3068\u3002\u3053\u308c\u3092\u3057\u306a\u3044\u3068ClassNotFoundException\u306b\u306a\u308b\u3002 \u3042\u3068\u3001setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)\u3057\u306a\u3044\u3068\u3001\u4f8b\u3048\u3070\u8d77\u52d5\u3057\u305f\u30a2\u30d7\u30ea\u3092HOME\u30dc\u30bf\u30f3\u3067\u7d42\u4e86\u3057\u305f\u5f8c\u306b\u3082\u3046\u4e00\u56de\u81ea\u5206\u306e\u30a2\u30d7\u30ea\u3092\u7acb\u3061\u4e0a\u3052\u305f\u6642\u3001\u81ea\u5206\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u304b\u3089\u8d77\u52d5\u3057\u305fSomeActivity\u306e\u65b9\u306e\u753b\u9762\u304c\u51fa\u3066\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u4e8b\u306b\u306a\u308b\u3002\u3053\u308c\u3092\u907f\u3051\u308b\u306b\u306fIntent.FLAG_ACTIVITY_NEW_TASK\u30d5\u30e9\u30b0\u3092\u6307\u5b9a\u3057\u305f\u72b6\u614b\u3067startActivity()\u3059\u308b\u3002 \u3053\u306e\u3078\u3093\u306fTASK\u306b\u3064\u3044\u3066\u6574\u7406\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u305d\u3046\u3060\u3051\u3069\u3001\u5225\u306e\u6a5f\u4f1a\u306b\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,11,21],"tags":[],"class_list":["post-1226","post","type-post","status-publish","format-standard","hentry","category-android","category-develop","category-howto"],"_links":{"self":[{"href":"https:\/\/rawbytes.org\/index.php?rest_route=\/wp\/v2\/posts\/1226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rawbytes.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rawbytes.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rawbytes.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rawbytes.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1226"}],"version-history":[{"count":1,"href":"https:\/\/rawbytes.org\/index.php?rest_route=\/wp\/v2\/posts\/1226\/revisions"}],"predecessor-version":[{"id":1227,"href":"https:\/\/rawbytes.org\/index.php?rest_route=\/wp\/v2\/posts\/1226\/revisions\/1227"}],"wp:attachment":[{"href":"https:\/\/rawbytes.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rawbytes.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rawbytes.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}