{"id":24853,"date":"2021-06-20T09:00:41","date_gmt":"2021-06-20T00:00:41","guid":{"rendered":"https:\/\/mole-kingdom.com\/wpbl\/?p=24853"},"modified":"2021-06-13T15:35:46","modified_gmt":"2021-06-13T06:35:46","slug":"%e3%80%8ewelcome-to-android-basics-in-kotlin%e3%80%8f%e3%82%92%e3%82%84%e3%81%a3%e3%81%9f3","status":"publish","type":"post","link":"https:\/\/mole-kingdom.com\/wpbl\/2021\/06\/20\/24853.html","title":{"rendered":"\u300eWelcome to Android Basics in Kotlin\u300f\u3092\u3084\u3063\u305f(3)"},"content":{"rendered":"<h1>\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3<\/h1>\n<h2>\u753b\u9762\u9593\u3092\u79fb\u52d5\u3059\u308b<\/h2>\n<h3>2. \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u8a73\u7d30<\/h3>\n<h4>\u30bb\u30c3\u30c8\u306e\u8a73\u7d30<\/h4>\n<p><span class=\"os\">All of the code above:<\/span>\u3063\u3066\u30b3\u30fc\u30c9\u3058\u3083\u306a\u304f\u3066\"\u4ee5\u4e0a\u306e\u30b3\u30fc\u30c9\u5168\u4f53\u3092\u6b21\u306b\u793a\u3057\u307e\u3059\u3002\"\u307f\u305f\u3044\u306a\u611f\u3058\u306e\u901a\u5e38\u6587\u306a\u3093\u3058\u3083\u306a\u3044\u304b\u306a\uff1f<\/p>\n<h3>4. \u30e9\u30e0\u30c0\u5f0f\u3068\u9ad8\u968e\u95a2\u6570\u306e\u8a73\u7d30<\/h3>\n<h4>\u9ad8\u968e\u95a2\u6570<\/h4>\n<p><span class=\"os\">\u306b\u4f7f\u7528\u3057\u307e\u3059\u3057\u304b\u3057<\/span> \u53e5\u70b9\u629c\u3051\u3002<\/p>\n<hr width=\"90%\">\n<h2>\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3068\u30a4\u30f3\u30c6\u30f3\u30c8<\/h2>\n<h3>5. \u660e\u793a\u7684\u30a4\u30f3\u30c6\u30f3\u30c8\u3092\u8a2d\u5b9a\u3059\u308b<\/h3>\n<p><span class=\"os\">\u30c7\u30b9\u30c6\u30a3\u30cd\u30fc\u30b7\u30e7\u30f3 \u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306e<\/span><br \/>\n\u308f\u304b\u308a\u306b\u304f\u3044\u306a\u2026\u306a\u3093\u3066\u8a00\u3048\u3070\u3044\u3044\u306e\u304b\u306a\uff1f<br \/>\n\u547c\u3073\u51fa\u3057\u5148\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\uff1f \u8d77\u52d5\u3059\u308b\u5b9b\u5148\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\uff1f<\/p>\n<p><span class=\"os\">\u5f8c\u3067\u53d6\u5f97\u3055\u308c\u308b\u540d\u524d\u304c\u6307\u5b9a\u3055\u308c\u305f<\/span><br \/>\n\u3053\u308c\u3082\u82e5\u5e72\u308f\u304b\u308a\u306b\u304f\u3044\u306a<br \/>\n\u5b9b\u5148\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3067\u53d6\u5f97\u3059\u308b\u969b\u306b\u4f7f\u7528\u3055\u308c\u308b\u540d\u524d\u304c\u6307\u5b9a\u3055\u308c\u305f\u2026\u3060\u3068\u5197\u9577\u304b<br \/>\n<span class=\"ss\">\u5f8c\u3067\u53d6\u5f97\u3055\u308c\u308b\u540d\u524d(\u3053\u306e\u4f8b\u3067\u306fletter)\u304c\u6307\u5b9a\u3055\u308c\u305f <\/span><br \/>\n<span class=\"ss\">\u6570\u5024\u3084\u6587\u5b57\u5217\u306a\u3069\u306e\u30c7\u30fc\u30bf(\u3053\u306e\u4f8b\u3067\u306fholder.button.text.toString())<\/span>\u3082\u9577\u3044\u304b\u2026<br \/>\n<span class=\"ss\">intent.putExtra(\u8b58\u5225\u540d,\u30c7\u30fc\u30bf)<\/span>\u3068\u304b\u306b\u3059\u308b\u304b\u2026<\/p>\n<h3>6. DetailActivity \u3092\u8a2d\u5b9a\u3059\u308b<\/h3>\n<p>\u8a73\u7d30\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3<br \/>\nDetailActivity\u3092\u8a33\u3057\u3061\u3083\u3063\u3066\u308b\u611f\u3058\uff1f<\/p>\n<p>\u30b3\u30f3\u30d1\u30cb\u30aa\u30f3\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3063\u3066\u306a\u3093\u304b\u4e0d\u601d\u8b70\u306a\u5b58\u5728\u306e\u3088\u3046\u306a\u2026<br \/>\n\u30af\u30e9\u30b9\u5909\u6570(\u5b9a\u6570\uff1f)\u3068\u3069\u3046\u9055\u3046\u306e\u304b\u2026<br \/>\n\u30b3\u30f3\u30d1\u30cb\u30aa\u30f3\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f55\u51e6\u306b\u542b\u3081\u308b\u3079\u304d\u304b\u3068\u304b\u8003\u3048\u3061\u3083\u3046\u3068\u6614\u306a\u304c\u3089\u306e\u5b9a\u6570\u8a18\u8ff0\u7528\u306e\u30af\u30e9\u30b9\u3092\u7528\u610f\u306b\u3057\u3061\u3083\u3063\u305f\u308a\u3057\u3066\u3082\u5927\u5dee\u306a\u3044\u3088\u3046\u306a\u6c17\u3082\u3059\u308b\u3051\u3069\u3001import\u306e\u6709\u7121\u304c\u51fa\u3066\u304f\u308b\u306e\u304b\u306a\uff1f<\/p>\n<p><a href=\"https:\/\/hydrakecat.hatenablog.jp\/entry\/2017\/12\/02\/companion_object_vs._top-level\" rel=\"noopener\" target=\"_blank\">companion object vs. top-level<\/a><\/p>\n<p>\u3046\u30fc\u3093\u3001\u307e\u3042\u4eca\u306e\u4ffa\u6c0f\u306e\u30ec\u30d9\u30eb\u3067\u306f\u6df1\u304f\u6c17\u306b\u3059\u308b\u3053\u3068\u306f\u306a\u3044\u3088\u3046\u3060\u306a(\uff89\u2200`)<br \/>\n\u3064\u30fc\u304b\u591a\u5206\u3053\u306e\u5148\u3082\u4ffa\u6c0f\u306e\u30ec\u30d9\u30eb\u3060\u3068\u305d\u3093\u306a\u306b\u6c17\u306b\u3059\u308b\u3053\u3068\u306f\u306a\u3055\u305d\u3046\uff57<\/p>\n<hr width=\"90%\">\n<h3>9. \u30e1\u30cb\u30e5\u30fc\u30dc\u30bf\u30f3\u3092\u5b9f\u88c5\u3059\u308b<\/h3>\n<p><span class=\"os\">\u7dda\u5f62\u30ec\u30a4\u30a2\u30a6\u30c8 \u30de\u30cd\u30fc\u30b8\u30e3\u30fc<\/span><br \/>\n<span class=\"ss\">\u30ea\u30cb\u30a2\u30ec\u30a4\u30a2\u30a6\u30c8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc<\/span>\u306e\u65b9\u304c\u307e\u3060\u308f\u304b\u308a\u3084\u3059\u3044\u304b\u306a\u3002<\/p>\n<p><span class=\"ss\">\u5426\u5b9a\u3057\u307e\u3059<\/span><br \/>\n\u5207\u308a\u66ff\u3048\u307e\u3059\u3068\u304b\u3067\u3048\u3048\u3093\u3067\u306a\u3044\u306e\u304b\u306a\uff1f<\/p>\n<blockquote><p>\u6ce8: onCreate() \u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3059\u308b\u5834\u5408\u3001\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306e\u4f5c\u6210\u3092\u5b8c\u4e86\u3059\u308b\u306b\u306f\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u306e\u5b9f\u88c5\u3092\u547c\u3073\u51fa\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u5185\u3067\u3059\u3050\u306b super.onCreate() \u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002\u4ed6\u306e\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb \u30b3\u30fc\u30eb\u30d0\u30c3\u30af \u30e1\u30bd\u30c3\u30c9\u306b\u3064\u3044\u3066\u3082\u540c\u3058\u3053\u3068\u304c\u8a00\u3048\u307e\u3059\u3002<\/p><\/blockquote>\n<p>\u3078\u3047\u3001\u305d\u3046\u3044\u3046\u3053\u3068\u3060\u3063\u305f\u3093\u304b\u3044(\u30fb\u2200\u30fb)\u3000<\/p>\n<p>\u30b3\u30fc\u30c9\u3067\u306fBundle\u306fnull\u8a31\u5bb9\u306b\u306a\u3063\u3066\u308b\uff1f<\/p>\n<blockquote><p>\u6ce8: \u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u304c\u518d\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u3001onRestoreInstanceState() \u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306f\u3001onStart() \u306e\u5f8c\u306b\u30d0\u30f3\u30c9\u30eb\u3068\u3068\u3082\u306b\u547c\u3073\u51fa\u3055\u308c\u307e\u3059\u3002\u307b\u3068\u3093\u3069\u306e\u5834\u5408\u3001onCreate() \u3067\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u306e\u72b6\u614b\u3092\u5fa9\u5143\u3057\u307e\u3059\u3002\u305f\u3060\u3057\u3001onRestoreInstanceState() \u306f onStart() \u306e\u5f8c\u306b\u547c\u3073\u51fa\u3055\u308c\u308b\u305f\u3081\u3001onCreate() \u3092\u547c\u3073\u51fa\u3057\u305f\u5f8c\u3067\u72b6\u614b\u3092\u5fa9\u5143\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u306f\u3001onRestoreInstanceState() \u3092\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<\/p><\/blockquote>\n<p>\u3075\u30fc\u3080\u3002<\/p>\n<p>\u304a\u304b\u3057\u3044\u306a\u3001\u753b\u9762\u56de\u8ee2\u5f8c\u3001\u30c7\u30b6\u30fc\u30c8\u306e\u7d75\u306f\u4fdd\u6301\u3055\u308c\u308b\u306e\u306b\u3001\u30c7\u30b6\u30fc\u30c8\u6570\u3068\u91d1\u984d\u304c0\u306b\u306a\u308b\u3002<br \/>\n\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u6b63\u3057\u3044(?)\u7d2f\u7a4d\u6570\u3001\u7d2f\u7a4d\u91d1\u984d\u306b\u306a\u308b\u3093\u3060\u3051\u3069\u3082\u3002<br \/>\n\u63cf\u753b\u306e\u66f4\u65b0\u3068\u304b\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u304b\u306a\u2026<br \/>\n\u306a\u3093\u304b\u3084\u308a\u65b9\u9593\u9055\u3048\u305f\u304b\uff1f<\/p>\n<p><span class=\"f_l\">\u308f\u304b\u3063\u305f\uff57<\/span><br \/>\n\"binding \u5909\u6570\u306e\u8a2d\u5b9a\u306e\u5f8c\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002\"\u3063\u3066\u3042\u3063\u305f\u304b\u3089\u4e00\u756a\u6700\u5f8c\u306b\u8ffd\u52a0\u3057\u3061\u3083\u3063\u305f\u3051\u3069\u3001<br \/>\n\"\/\/ Set the TextViews to the right values\"\u306e\u524d\u306b\u8cbc\u3089\u306a\u3044\u3068<br \/>\n\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3055\u308c\u3066\u308bTextView\u306b\u5024\u3092\u4ee3\u5165\u3057\u306a\u3044\u308f\u3051\u3060\u306a(\uff89\u2200`)<\/p>\n<hr width=\"90%\">\n<h2>\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u3068\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3 \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/h2>\n<h3>3. \u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u3068\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8 \u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb<\/h3>\n<h4>\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8 \u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb<\/h4>\n<p>\"fragments can be initialized and removed from memory\"<br \/>\n<span class=\"os\">\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306f\u521d\u671f\u5316\u3057\u3066\u30e1\u30e2\u30ea\u304b\u3089\u524a\u9664\u3067\u304d\u307e\u3059\u3002<\/span><br \/>\n\u3053\u308c\u306f\u9055\u3046\u3088\u306d\uff57<br \/>\n<span class=\"ss\">\u521d\u671f\u5316\u53ca\u3073\u524a\u9664\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/span>\u306e\u65b9\u304c\u59a5\u5f53\u3060\u3088\u306d\u3002<\/p>\n<p>\"Also, just like activities, fragments have a lifecycle with several states,\"<br \/>\n<span class=\"os\">\u307e\u305f\u3001\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3068\u540c\u69d8\u306b\u3001\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306b\u306f\u8907\u6570\u306e\u72b6\u614b\u3092\u6301\u3064\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u304c\u3042\u308a<\/span><br \/>\n\"\u8907\u6570\u306e\"\u3060\u3068\u540c\u6642\u306b\u72b6\u614b\u3092\u8907\u6570\u6301\u3064\u3068\u3044\u3046\u610f\u5473\u306b\u3082\u53d6\u308c\u305d\u3046\u3067\u5fae\u5999\u3060\u306a\u3002<br \/>\n\"\u6570\u7a2e\u306e\"\u304c\u3044\u3044\u304b\u2026\u3046\u30fc\u3080\u2026<br \/>\nAlso\u3060\u304b\u3089<span class=\"ss\">\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3068\u540c\u69d8\u306b\u3001\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u306b\u3082\u6570\u7a2e\u306e\u72b6\u614b\u3092\u6301\u3064\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u304c\u3042\u308a<\/span>\u304b\u306a\uff1f<\/p>\n<hr width=\"90%\">\n<h3>6. DetailActivity \u3092 WordListFragment \u306b\u5909\u63db\u3059\u308b<\/h3>\n<p><span class=\"os\">onClickListener() \u306e LetterAdapter<\/span> LetterAdapter\u306eonClickListener()\uff1f<\/p>\n<p>LetterListFragment\u306eonCreateView\u3067<span class=\"os\">val view = binding.root<\/span>\u3082<span class=\"ss\">return binding.root<\/span><\/p>\n<p>\u306a\u3093\u3067build.gradle\u3063\u3066\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u7528\u3068\u30e2\u30b8\u30e5\u30fc\u30eb\u7528\u306b\u5206\u304b\u308c\u3066\u308b\u3093\u3060\u308d\u3046\u306a(\u00b4\uff65\u03c9\uff65\uff40)<br \/>\n\u3064\u30fc\u304b\u5206\u304b\u308c\u3066\u308b\u306a\u3089\u540d\u524d\u3092\u5909\u3048\u308b\u65b9\u304c\u826f\u3055\u305d\u3046\u3060\u3051\u3069\u3082\u2026<\/p>\n<p>\u6216\u3044\u306f\u30a8\u30c7\u30a3\u30bf\u4e0a\u3067\u306f\u5358\u4e00\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u3088\u3046\u306b\u898b\u305b\u304b\u3051\u308b\u3068\u304b\u2026<br \/>\n\u8aac\u660e\u6587\u3060\u3068\u30a2\u30d7\u30ea\u30ec\u30d9\u30eb\u3063\u3066\u3042\u308b\u3051\u3069IDE\u4e0a\u3060\u3068\"\u30e2\u30b8\u30e5\u30fc\u30eb:Words.app\"\u3068\u8868\u793a\u3055\u308c\u3066\u3044\u3066\u308f\u304b\u308a\u306b\u304f\u3044\u3057\u3002<\/p>\n<p>\u3064\u30fc\u304b\u3053\u306e\u8fba\u306egradle\u30d5\u30a1\u30a4\u30eb\u306e\u7de8\u96c6\u306b\u3064\u3044\u3066\u3082IDE\u304c\u826f\u304d\u306b\u8a08\u3089\u3063\u3066\u304f\u308c\u306a\u3044\u3082\u3093\u3060\u308d\u3046\u304b\u3002<\/p>\n<p>\u53ef\u80fd\u6027\u306e\u3042\u308b\u30c7\u30b9\u30c6\u30a3\u30cd\u30fc\u30b7\u30e7\u30f3 possible destinations\u3063\u3066\u4e0a\u3067\u8a00\u3063\u3066\u3044\u308b\u3001<br \/>\n\u79fb\u52d5\u3067\u304d\u308b\u300c\u30c7\u30b9\u30c6\u30a3\u30cd\u30fc\u30b7\u30e7\u30f3\u300da possible \"destination\" that can be navigated to.\u306e\u7701\u7565\u306a\u3093\u3060\u308d\u3046\u306a\u3002 \u3069\u3063\u3061\u3082\u3042\u308c\u3060\u306a\u2026\"\u79fb\u52d5\u53ef\u80fd\u306a\"\u8fba\u308a\u304b\u306a\uff1f<\/p>\n<p><span class=\"os\">layout_height \u5c5e\u6027\u3068 layout_width \u5c5e\u6027\u306e\u4e0b\u306b<\/span><br \/>\n<span class=\"os\">layout_height \u5c5e\u6027\u3068<\/span>\u306e\u90e8\u5206\u306f\u4e0d\u8981\u3067\u306f\u306a\u304b\u308d\u3046\u304b\uff1f<\/p>\n<hr width=\"90%\">\n<h3>8. \u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3 \u30b0\u30e9\u30d5\u306e\u4f7f\u7528<\/h3>\n<h4>\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3 \u30b0\u30e9\u30d5\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b<\/h4>\n<p>\u306a\u3093\u304b\u64cd\u4f5c\u3092\u9593\u9055\u3048\u305f\u306e\u304b\u3001\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u30b0\u30e9\u30d5\u306b\u306f\u8868\u793a\u3055\u308c\u3066\u3044\u306a\u3044\u3002<br \/>\n\u3053\u308c\u306f\u81ea\u5206\u3067\u8ffd\u52a0\u3057\u3066\u3044\u304b\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u304b\uff1f<br \/>\n\u3060\u3068\u3059\u308b\u3068\u753b\u50cf\u304c\u4e00\u3064\u98db\u3093\u3067\u308b\u306e\u3067\u306f\u306a\u304b\u308d\u3046\u304b\u2026<br \/>\n\u753b\u9762\u5de6\u4e0a\u3068\u3044\u3046\u8868\u73fe\u3082\u5fae\u5999\u3060\u306a\u3002\u30c7\u30b6\u30a4\u30f3\u30da\u30a4\u30f3(?)\u306e\u5de6\u4e0a\u3068\u304b\u8a00\u308f\u306a\u3044\u3068\u4e00\u77ac\u60a9\u3080\u3060\u308d\u3046\u2026<\/p>\n<p><span class=\"os\">setupActionBarWithNavController(navController)<\/span>\u3063\u3066\u306a\u3044\u306a\u2026(\u00b4\uff65\u03c9\uff65\uff40)<br \/>\n<span class=\"ss\">setupActionBarWithNavController(this,navController)<\/span>\u306e\u65b9\u306b\u3057\u3066\u307f\u305f\u304c\u2026<\/p>\n<p>\u30d5\u30e9\u30b0\u30e1\u30f3\u30c8\u3068\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u7d61\u307f\u306f\u304d\u3061\u3093\u3068\u89e3\u8aac\u30da\u30fc\u30b8\u3092\u8aad\u307e\u306a\u3044\u3068\u628a\u63e1\u3067\u304d\u305d\u3046\u306b\u306a\u3044\u306a(\uff89\u2200`)<\/p>\n<hr width=\"90%\">\n<h2>ViewModel \u306b\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b<\/h2>\n<h3>2. \u30b9\u30bf\u30fc\u30bf\u30fc \u30a2\u30d7\u30ea\u306e\u6982\u8981<\/h3>\n<h4>\u30b2\u30fc\u30e0\u306e\u6982\u8981<\/h4>\n<p>\u3050\u3050\u3063\u3066\u307f\u305f\u304c\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3068\u3044\u3046\u8a00\u8449\u306e\u5b9a\u7fa9\u304c\u3044\u307e\u3044\u3061\u308f\u304b\u308a\u306b\u304f\u3044(\u00b4\uff65\u03c9\uff65\uff40)<br \/>\n\u4f55\u3068\u306a\u304f\u308f\u304b\u3063\u305f\u3088\u3046\u306a\u6c17\u304c\u3059\u308b\u304c\u3001\u306a\u3093\u304b\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u306b\u3088\u3063\u3066\u610f\u5473\u304c\u82e5\u5e72\u5909\u308f\u308a\u305d\u3046\u306a\u611f\u3058\u304c\u3057\u3066\u66d6\u6627\u30e2\u30b3\u30e2\u30b3\u3067\u3042\u308b\u2026<\/p>\n<h3>4. ViewModel \u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n<p>viewModels\u3078\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u79fb\u8b72\u3082\u82e5\u5e72\u308f\u304b\u308a\u306b\u304f\u3044\u2026<br \/>\n\u30b3\u30fc\u30c9\u4e0a\u306e\u5909\u6570\u540dviewModel\u3060\u3068\u7d1b\u3089\u308f\u3057\u3044\u304b\u3089gameViewModel\u3068\u304b\u306b\u3057\u3068\u3044\u3066\u304f\u308c\u305f\u3089\u826f\u304b\u3063\u305f\u306e\u306b\u306a\u3002<\/p>\n<h3>6. ViewModel \u306e\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb<\/h3>\n<p><span class=\"os\">4.onCreateView() \u5185\u306e GameFragment<\/span><br \/>\n\u3053\u3053\u3082\u9006\u304b\u306a\uff1f<\/p>\n<h3>7. ViewModel \u3092\u8a2d\u5b9a\u3059\u308b<\/h3>\n<h4>\u6b21\u306e\u5358\u8a9e\u3092\u53d6\u5f97\u3059\u308b<\/h4>\n<p><span class=\"os\">currentWord.<\/span><\/p>\n<pre class=\"brush: kotlin; title: ; notranslate\" title=\"\">\r\ncurrentWord = allWordsList.random()\r\nval tempWord = currentWord.toCharArray()\r\ntempWord.shuffle()\r\n\r\nwhile (tempWord.toString().equals(currentWord, false)) {\r\n    tempWord.shuffle()\r\n}\r\n<\/pre>\n<p>\u3063\u3066\u30b3\u30fc\u30c9\u3001\u672c\u5f53\u306b\u52d5\u304f(\u00b4\uff65\u03c9\uff65\uff40)\uff1f<\/p>\n<p>tempWord.toString()\u3058\u3083\u306a\u304f\u3066\u3001String(tempWord)\u3068\u304btempWord.joinToString(\"\")\u3058\u3083\u306a\u3044\u3068\u3046\u3061\u3067\u306f\u52d5\u304b\u306a\u3044\u3002<\/p>\n<p>issues\u306b\u306f53\u3068<a href=\"https:\/\/github.com\/google-developer-training\/android-basics-kotlin-unscramble-app\/issues\/58\" rel=\"noopener\" target=\"_blank\">58<\/a>\u306872\u3067\u4e0a\u304c\u3063\u3066\u308b\u3063\u307d\u3044\u306d\u3047<\/p>\n<hr width=\"90%\">\n<h4>\u30d8\u30eb\u30d1\u30fc \u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3059\u308b<\/h4>\n<p><span class=\"os\">nextWord().<\/span> <\/p>\n<h3>8. \u30c0\u30a4\u30a2\u30ed\u30b0<\/h3>\n<h4>\u30a2\u30e9\u30fc\u30c8 \u30c0\u30a4\u30a2\u30ed\u30b0\u306e\u69cb\u9020<\/h4>\n<p>\u2464\u306e\u8aac\u660e\u306f\uff1f<\/p>\n<p>\u5f8c\u7f6e\u30e9\u30e0\u30c0\u69cb\u6587\u3063\u3066\u3061\u3087\u3063\u3068\u52d8\u9055\u3044\u3057\u305d\u3046\u3060\u306a(\u00b4\uff65\u03c9\uff65\uff40)<br \/>\n\u5f15\u6570\u95a2\u6570\u3068\u306f\u601d\u3044\u96e3\u3044\u3002\u6ce2\u62ec\u5f27\u5f8c\u306e\".\"\u304c\u5c11\u3057\u53d7\u3051\u5165\u308c\u304c\u305f\u3044\uff57<\/p>\n<p><del datetime=\"2021-06-12T21:58:54+00:00\">private fun getNextScrambledWord()\u3063\u3066\u4e0d\u8981\u3058\u3083\u306a\u3044\u304b\uff1f<\/del>\u3000<span class=\"f_s\">\u2190\u3000\u4e00\u756a\u6700\u5f8c\u3067\u6d88\u3057\u3066\u305f<\/span><\/p>\n<h3>9. Submit \u30dc\u30bf\u30f3\u306e OnClickListener \u3092\u5b9f\u88c5\u3059\u308b<\/h3>\n<h4>\u30b9\u30af\u30e9\u30f3\u30d6\u30eb\u3055\u308c\u305f\u5358\u8a9e\u3092\u8868\u793a\u3059\u308b<\/h4>\n<p><span class=\"os\">onSubmitWord() \u306a\u3044<\/span><br \/>\n<span class=\"ss\">\u5185<\/span>\uff1f<\/p>\n<h4>\u30b9\u30bf\u30fc\u30bf\u30fc \u30b3\u30fc\u30c9\u5185\u306e\u30b3\u30fc\u30c9 \u30b9\u30cb\u30da\u30c3\u30c8<\/h4>\n<p><span class=\"os\">GameFragment,<\/span><\/p>\n<h2>ViewModel\u3067LiveData\u3092\u4f7f\u7528\u3059\u308b<\/h2>\n<p><span class=\"os\">LiveData.<\/span><\/p>\n<h3>4. \u73fe\u5728\u306e\u30b9\u30af\u30e9\u30f3\u30d6\u30eb\u3055\u308c\u305f\u5358\u8a9e\u306b LiveData \u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n<p><span class=\"os\">LiveData,<\/span><\/p>\n<p><span class=\"os\">currentScrambledWord LiveData \u306e\u30aa\u30d6\u30b6\u30fc\u30d0\u30fc<\/span><br \/>\n<span class=\"ss\">\u306e<\/span>\u3092\u5165\u308c\u308b\u304b\u3001LiveData\u304c\u4e0d\u8981\uff1f<\/p>\n<h3>6. \u30aa\u30d6\u30b6\u30fc\u30d0\u30fc\u3092\u30b9\u30b3\u30a2\u3068\u5358\u8a9e\u6570\u306b\u63a5\u7d9a\u3059\u308b<\/h3>\n<h4>\u30b9\u30c6\u30c3\u30d7 2: \u30aa\u30d6\u30b6\u30fc\u30d0\u30fc\u3092\u30b9\u30b3\u30a2\u3068\u5358\u8a9e\u6570\u306b\u63a5\u7d9a\u3059\u308b<\/h4>\n<p><span class=\"os\">onViewCreated()\u30e1\u30bd\u30c3\u30c9\u306e\u6700\u5f8c\u306b\u3042\u308bGameFragment\u3067<\/span>\uff1f<br \/>\n<span class=\"os\">currentWordCount LiveData<\/span> \u3000<span class=\"f_s\">\u2190 \u3053\u306e2\u3064\u306f\u4f55\u3092\u6307\u6458\u3057\u3066\u3044\u308b\u306e\u304b\u601d\u3044\u51fa\u305b\u306a\u3044(\uff89\u2200`)<\/span><\/p>\n<p>LiveData\u30aa\u30d6\u30b6\u30fc\u30d0\u30fc\u3082\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u5f0f\u3082\u4fbf\u5229\u3067\u3048\u3048\u306e\u3045(\u30fb\u2200\u30fb)<\/p>\n<p>TalkBack\u306f\u307e\u305f\u98db\u3070\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3 \u753b\u9762\u9593\u3092\u79fb\u52d5\u3059\u308b 2. \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u8a73\u7d30 \u30bb\u30c3\u30c8\u306e\u8a73\u7d30 All of the code above:\u3063\u3066\u30b3\u30fc\u30c9\u3058\u3083\u306a\u304f\u3066\"\u4ee5\u4e0a\u306e\u30b3\u30fc\u30c9\u5168\u4f53\u3092\u6b21\u306b\u793a\u3057\u307e\u3059\u3002\"\u307f\u305f\u3044\u306a\u611f\u3058\u306e\u901a\u5e38\u6587\u306a\u3093\u3058\u3083\u306a\u3044\u304b\u306a\uff1f 4. ...  <a class=\"excerpt-read-more\" href=\"https:\/\/mole-kingdom.com\/wpbl\/2021\/06\/20\/24853.html\" title=\"Read \u300eWelcome to Android Basics in Kotlin\u300f\u3092\u3084\u3063\u305f(3)\">\u3082\u3063\u3068\u8aad\u3080 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[18,124,95],"tags":[],"class_list":["post-24853","post","type-post","status-publish","format-standard","hentry","category-android","category-kotlin","category-impressions"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2pLuj-6sR","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":22847,"url":"https:\/\/mole-kingdom.com\/wpbl\/2020\/12\/21\/22847.html","url_meta":{"origin":24853,"position":0},"title":"\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3(\u62e1\u5f35) : kotlin","author":"moleking","date":"2020\u5e7412\u670821\u65e5","format":false,"excerpt":"\u203b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\u5168\u3066\"Target platform: JVMRunning on kotlin v\u2026","rel":"","context":"kotlin","block_context":{"text":"kotlin","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/programming\/kotlin"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24757,"url":"https:\/\/mole-kingdom.com\/wpbl\/2021\/06\/14\/24757.html","url_meta":{"origin":24853,"position":1},"title":"\u300eWelcome to Android Basics in Kotlin\u300f\u3092\u3084\u3063\u305f(1)","author":"moleking","date":"2021\u5e746\u670814\u65e5","format":false,"excerpt":"kotlin\u306e\u5b66\u7fd2\u3064\u3044\u3067\u306bAndroid\u306b\u3064\u3044\u3066\u306e\u5fa9\u7fd2\u3092\u3057\u3088\u3046\u3068Welcome to Android\u2026","rel":"","context":"Android","block_context":{"text":"Android","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/os\/android"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mole-kingdom.com\/wpbl\/wp-content\/uploads\/2021\/06\/notcontainerror.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mole-kingdom.com\/wpbl\/wp-content\/uploads\/2021\/06\/notcontainerror.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/mole-kingdom.com\/wpbl\/wp-content\/uploads\/2021\/06\/notcontainerror.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":23601,"url":"https:\/\/mole-kingdom.com\/wpbl\/2021\/02\/21\/23601.html","url_meta":{"origin":24853,"position":2},"title":"\u3046\u306b\u306e\u30c8\u30b2\u306f\u523a\u3055\u308b\u3068\u75db\u3044(\u00b4\uff65\u03c9\uff65\uff40)-39","author":"moleking","date":"2021\u5e742\u670821\u65e5","format":false,"excerpt":"\u305d\u308c\u307b\u3069\u5fc5\u8981\u3067\u3082\u306a\u304b\u3063\u305f\u306e\u3060\u304c\u3001Unity\u4e0a\u3067MediaStore\u3068ContentResolver\u3092\u2026","rel":"","context":"Unity","block_context":{"text":"Unity","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/software-2\/unity"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24848,"url":"https:\/\/mole-kingdom.com\/wpbl\/2021\/06\/17\/24848.html","url_meta":{"origin":24853,"position":3},"title":"\u300eWelcome to Android Basics in Kotlin\u300f\u3092\u3084\u3063\u305f(2)","author":"moleking","date":"2021\u5e746\u670817\u65e5","format":false,"excerpt":"Layouts Kotlin\u306e\u30af\u30e9\u30b9\u3068\u7d99\u627f 2. \u30af\u30e9\u30b9\u968e\u5c64\u3068\u306f \u4e00\u5fdc\u3001\"\u8c46\u985e\"\u306e\u3068\u3053\u308d\u306e\u30ea\u30f3\u30af\u304ch\u2026","rel":"","context":"Android","block_context":{"text":"Android","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/os\/android"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":23665,"url":"https:\/\/mole-kingdom.com\/wpbl\/2021\/03\/01\/23665.html","url_meta":{"origin":24853,"position":4},"title":"\u3046\u306b\u306e\u30c8\u30b2\u306f\u523a\u3055\u308b\u3068\u75db\u3044(\u00b4\uff65\u03c9\uff65\uff40)-41 : Java \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u5229\u7528 (Unity\u5074)","author":"moleking","date":"2021\u5e743\u67081\u65e5","format":false,"excerpt":"\u524d\u56de\u306e\u30a8\u30f3\u30c8\u30ea\u306b\u7d9a\u304d\u3001Unity\u5074\u306e\u624b\u9806\u3002 \u5c1a\u3001\u4eca\u56de\u306e\u8a2d\u5b9a\u5024\u7b49\u306f\u524d\u56de\u306e\u8a2d\u5b9a\u5024\u3068\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u3002 Uni\u2026","rel":"","context":"Android Studio","block_context":{"text":"Android Studio","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/software-2\/android-studio"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mole-kingdom.com\/wpbl\/wp-content\/uploads\/2021\/02\/makecsharpscript.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mole-kingdom.com\/wpbl\/wp-content\/uploads\/2021\/02\/makecsharpscript.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/mole-kingdom.com\/wpbl\/wp-content\/uploads\/2021\/02\/makecsharpscript.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":24487,"url":"https:\/\/mole-kingdom.com\/wpbl\/2021\/05\/27\/24487.html","url_meta":{"origin":24853,"position":5},"title":"\u6700\u8fd1\u3001\u9069\u5f53\u306b\u3084\u3063\u3066\u3001\u8272\u3005\u3084\u3089\u304b\u3057\u305f\u30df\u30b9\u3084\u96d1\u591a\u306a\u4f5c\u696d\u306e\u8a18\u9332(\uff89\u2200`)","author":"moleking","date":"2021\u5e745\u670827\u65e5","format":false,"excerpt":"\u5404\u9805\u76ee\u3001\u304c\u3063\u3064\u308a\u3068\u6398\u308c\u3070\u3001\u30a8\u30f3\u30c8\u30ea\u5316\u306e\u610f\u7fa9\u3082\u51fa\u3066\u3053\u306a\u304f\u3082\u306a\u3044\u304c\u3001\u305d\u3053\u307e\u3067\u8208\u5473\u304c\u306a\u304b\u3063\u305f\u308a\u3001\u9762\u5012\u304f\u3055\u3044\u2026","rel":"","context":"Android Studio","block_context":{"text":"Android Studio","link":"https:\/\/mole-kingdom.com\/wpbl\/category\/software-2\/android-studio"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/posts\/24853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/comments?post=24853"}],"version-history":[{"count":5,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/posts\/24853\/revisions"}],"predecessor-version":[{"id":24866,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/posts\/24853\/revisions\/24866"}],"wp:attachment":[{"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/media?parent=24853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/categories?post=24853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mole-kingdom.com\/wpbl\/wp-json\/wp\/v2\/tags?post=24853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}