

{"id":1621,"date":"2022-03-18T15:00:08","date_gmt":"2022-03-18T06:00:08","guid":{"rendered":"https:\/\/curecode.jp\/tech\/?p=1621"},"modified":"2022-03-15T15:31:32","modified_gmt":"2022-03-15T06:31:32","slug":"xamarin-android-intent-resolveactivity-is-null","status":"publish","type":"post","link":"https:\/\/curecode.jp\/tech\/xamarin-android-intent-resolveactivity-is-null\/","title":{"rendered":"[Xamarin] Android intent.ResolveActivity \u304c null \u306b\u306a\u308b"},"content":{"rendered":"<h3>ResolveActivity \u306e\u5fc5\u8981\u6027\u306b\u3064\u3044\u3066<\/h3>\n<p>\n  Android \u306e\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u30a2\u30d7\u30ea\u3067\u51e6\u7406\u3067\u304d\u306a\u3044\u30a4\u30f3\u30c6\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u3066 StartActivityForResult \u3092\u547c\u3073\u51fa\u3059\u3068\u30af\u30e9\u30c3\u30b7\u30e5\u3059\u308b\u306e\u3067\u3001ResolveActivity \u3067\u547c\u3073\u51fa\u3057\u3092\u4fdd\u8b77\u3059\u308b\u3053\u3068\u304c\u6c42\u3081\u3089\u308c\u3066\u3044\u307e\u3059\u3002\n<\/p>\n<p>\n  ResolveActivity \u3092\u3057\u306a\u3044\u3067 try \uff5e catch \u3059\u308b\u3068\u3044\u3046\u65b9\u6cd5\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u63a8\u5968\u306f\u3055\u308c\u307e\u305b\u3093\u3002\n<\/p>\n<p>\n  Xamarin.Android \u3067\u4ed6\u306e\u30ab\u30e1\u30e9\u30a2\u30d7\u30ea\u3092\u8d77\u52d5\u3057\u3066\u64ae\u5f71\u3057\u3066\u623b\u3057\u3066\u3082\u3089\u3046\u5834\u5408\u306f intent \u306b MediaStore.ActionImageCapture \u3092\u6307\u5b9a\u3057\u3066\u8d77\u52d5\u3057\u307e\u3059\u3002\n<\/p>\n<pre><code class=\"cs\">\r\n     var intent = new Intent(MediaStore.ActionImageCapture);\r\n\r\n     if (intent.ResolveActivity(PackageManager) != null)\r\n     {\r\n         intent.PutExtra(MediaStore.ExtraOutput, photo_uri);\r\n         StartActivityForResult(intent, RESULT_PHOTO_CAPTURE);\r\n     }\r\n<\/code><\/pre>\n<p>\n  ResolveActivity \u3092\u5165\u308c\u308b\u3068\u4e0a\u8a18\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u304c\u3001 <code>ResolveActivity()<\/code> \u306e\u623b\u308a\u5024\u304c\u5e38\u306b <samp>null<\/samp> \u306b\u306a\u3063\u3066\u3057\u307e\u3063\u3066\u3044\u307e\u3057\u305f\u3002\u4f55\u304c\u8db3\u308a\u306a\u3044\u306e\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<h3>\u89e3\u6c7a\u7b56<\/h3>\n<p>\n  AndroidManifest.xml \u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\n<\/p>\n<pre><code class=\"xml\">\r\n    <queries>\r\n        <!-- Camera -->\r\n        <intent>\r\n            <action android:name=\"android.media.action.IMAGE_CAPTURE\" \/>\r\n        <\/intent>\r\n        <!-- Gallery -->\r\n        <intent>\r\n            <action android:name=\"android.intent.action.GET_CONTENT\" \/>\r\n        <\/intent>\r\n    <\/queries>\r\n<\/code><\/pre>\n<p>\n  \u3053\u308c\u306f applications \u30bf\u30b0\u306e\u5916\u5074\u306b\u8a18\u8f09\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n<\/p>\n<p>\n  \u3053\u308c\u3092\u8a18\u8f09\u3059\u308b\u3053\u3068\u3067 ResolveActivity \u306e\u623b\u308a\u5024\u304c\u5e38\u306b null \u306b\u306a\u308b\u3053\u3068\u306f\u306a\u304f\u306a\u308a\u307e\u3059\u3002\n<\/p>\n<h3>IT\u30a8\u30f3\u30b8\u30cb\u30a2\u52df\u96c6\u4e2d\uff01<\/h3>\n<p>\u30ad\u30e5\u30a2\u30b3\u30fc\u30c9\u682a\u5f0f\u4f1a\u793e\u306fIT\u30a8\u30f3\u30b8\u30cb\u30a2\u3092\u52df\u96c6\u3057\u3066\u304a\u308a\u307e\u3059\u3002\u5c11\u4eba\u6570\u306e\u8077\u5834\u306a\u306e\u3067\u3001\u4e0a\u6d41\u30fb\u4e0b\u6d41\u3084\u30b5\u30fc\u30d0\u30fc\u30fb\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5bfe\u5fdc\u306e\u57a3\u6839\u306a\u304f\u3001\u3042\u306a\u305f\u306e\u5f37\u307f\u3092\u6d3b\u304b\u3057\u306a\u304c\u3089 \u3044\u308d\u3044\u308d\u306a\u3053\u3068\u306b\u30c1\u30e3\u30ec\u30f3\u30b8\u53ef\u80fd\u3067\u3059\u3002\u30a8\u30f3\u30b8\u30cb\u30a2\u3068\u3057\u3066\u306e\u672a\u7d4c\u9a13\u306e\u65b9\u3001\u7d4c\u9a13\u304c\u5c11\u306a\u3044\u65b9\u3082\u6b53\u8fce\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4e0b\u8a18\u3088\u308aIT\u30a8\u30f3\u30b8\u30cb\u30a2\u52df\u96c6\u306e\u63a1\u7528\u60c5\u5831\u3092\u3054\u89a7\u3044\u305f\u3060\u3051\u307e\u3059\u3002<\/p>\n<div class=\"curecode_recruit_bn\">\n\t\t\t\t<a href=\"https:\/\/curecode.jp\/recruit\/itengineer\/\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>\n\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/curecode.jp\/tech\/wp-content\/themes\/tech\/images\/it_recruit.png?20241220\" alt=\"\u4e8b\u696d\u62e1\u5927\u306b\u4f34\u3044\u65b0\u3057\u3044\u9818\u57df\u306b\u4e00\u7dd2\u306b\u53d6\u308a\u7d44\u3093\u3067\u3044\u304f\u30e1\u30f3\u30d0\u30fc\u3092\u52df\u96c6\u3057\u307e\u3059\u3002\"  width=\"500\" height=\"180\"\/><br \/>\n\t\t\t\t<\/a>\n\t\t<\/div>\n<h3>\u30ad\u30e5\u30a2\u30b3\u30fc\u30c9\u516c\u5f0f\u30a4\u30f3\u30b9\u30bf\u30b0\u30e9\u30e0<\/h3>\n<p>\u30ad\u30e5\u30a2\u30b3\u30fc\u30c9\u682a\u5f0f\u4f1a\u793e\u306e\u65b0\u30b5\u30fc\u30d3\u30b9\u60c5\u5831\u3084\u3001\u30aa\u30d5\u30a3\u30b9\u30e9\u30a4\u30d5\u306e\u7d20\u6575\u306a\u77ac\u9593\u307e\u3067\u3002\u79c1\u305f\u3061\u306e\u65e5\u3005\u306e\u55b6\u307f\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<div class=\"curecode_recruit_bn\">\n\t\t\t\t<a href=\"https:\/\/www.instagram.com\/curecode\/\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>\n\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/curecode.jp\/tech\/wp-content\/themes\/tech\/images\/insta_bn.png?20241220\" alt=\"\u4e8b\u696d\u62e1\u5927\u306b\u4f34\u3044\u65b0\u3057\u3044\u9818\u57df\u306b\u4e00\u7dd2\u306b\u53d6\u308a\u7d44\u3093\u3067\u3044\u304f\u30e1\u30f3\u30d0\u30fc\u3092\u52df\u96c6\u3057\u307e\u3059\u3002\"  width=\"500\" height=\"180\"\/><br \/>\n\t\t\t\t<\/a>\n\t\t<\/div>\n","protected":false},"excerpt":{"rendered":"<p>ResolveActivity \u306e\u5fc5\u8981\u6027\u306b\u3064\u3044\u3066 Android \u306e\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u30a2\u30d7\u30ea\u3067\u51e6\u7406\u3067\u304d\u306a [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":1161,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[127,141],"tags":[19,148],"class_list":["post-1621","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","category-xamarin","tag-android","tag-xamarin"],"_links":{"self":[{"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/posts\/1621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/comments?post=1621"}],"version-history":[{"count":5,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/posts\/1621\/revisions"}],"predecessor-version":[{"id":1626,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/posts\/1621\/revisions\/1626"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/media\/1161"}],"wp:attachment":[{"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/media?parent=1621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/categories?post=1621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/curecode.jp\/tech\/wp-json\/wp\/v2\/tags?post=1621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}