{"id":300,"date":"2018-12-23T21:29:09","date_gmt":"2018-12-23T12:29:09","guid":{"rendered":"https:\/\/dalomo.net\/blog\/?p=300"},"modified":"2018-12-23T21:30:23","modified_gmt":"2018-12-23T12:30:23","slug":"androidstudio%e3%81%a7%e3%83%87%e3%83%bc%e3%82%bf%e3%83%99%e3%83%bc%e3%82%b9%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f%e3%81%84bmi%e8%a8%88%e7%ae%97","status":"publish","type":"post","link":"https:\/\/dalomo.net\/blog\/2018\/12\/23\/300\/","title":{"rendered":"AndroidStudio\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f7f\u3063\u3066\u307f\u305f\u3044&#038;BMI\u8a08\u7b97"},"content":{"rendered":"<h2>SQLite<\/h2>\n<p>Plugin\u3092\u63a2\u3057\u3066\u3044\u305f\u3089\u3001SQL Android\u3068\u3044\u3046Plugin\u3092\u898b\u3064\u3051\u305f\u3002\u306a\u3093\u304b\u3059\u3054\u3044\u4fbf\u5229\u305d\u3046!\u3068\u601d\u3063\u305f\u306e\u3067\u4f7f\u3063\u3066\u307f\u305f\u304f\u306a\u3063\u305f\u3002\u306e\u3067\u3001RDB\u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u3092\u4f5c\u3063\u3066\u307f\u305f\u3044\u3002RDB\u306b\u95a2\u3057\u3066\u306f\u3001\u307b\u3068\u3093\u3069\u77e5\u8b58\u304c\u306a\u3044\u3002\u4ed5\u4e8b\u3067\u3061\u3087\u308d\u3063\u3068Access\u3092\u4f7f\u3063\u305f\u3053\u3068\u304c\u3042\u308b\u3051\u3069\u3001\u3059\u3063\u3054\u3044\u7c21\u5358\u306aSQL\u6587\u66f8\u304f\u3050\u3089\u3044\u3067\u3001\u30ea\u30ec\u30fc\u30b7\u30e7\u30f3\u5f35\u3063\u305f\u3053\u3068\u3082\u306a\u3044\u3050\u3089\u3044\u3002\u3067\u304d\u308b\u304b\u306a\u3002\u3067\u304d\u308b\u3060\u308d\u3002\u3064\u3044\u3067\u306b\u3061\u3087\u3053\u3061\u3087\u3053\u4f5c\u3063\u3066\u304f\u3084\u3064\u3082\u4f5c\u308d\u3046\u3002\u751f\u6d3b\u96fb\u5353\u3063\u3066\u540d\u524d\u306b\u3057\u3088\u3046\u3002<\/p>\n<h3>\u3068\u308a\u3042\u3048\u305aBMI\u8a08\u7b97\u6a5f\u3092\u4f5c\u308d\u3046<\/h3>\n<p>\u305d\u3093\u3067\u305d\u306e\u8a18\u9332\u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306bSQLite\u4f7f\u3048\u3070\u3044\u3044\u3093\u3060\u3002\u305d\u3046\u3057\u3088\u3046\u3002<\/p>\n<h4>\u753b\u9762\u4f5c\u308b<\/h4>\n<p>\u8272\u3093\u306a\u8a08\u7b97\u306e\u30ea\u30b9\u30c8\u2192\u500b\u5225\u306e\u8a08\u7b97\u2192\u305d\u306e\u8a08\u7b97\u306e\u5c65\u6b74\u307f\u305f\u3044\u306a\u9077\u79fb\u306b\u3057\u305f\u3044\u3002\u30ea\u30b9\u30c8\u3092\u4f5c\u308b\u306b\u306fListView\u3092\u4f7f\u3046\u307f\u305f\u3044\u3002\u898b\u3066\u307f\u305f\u3089Legacy\u306b\u5165\u3063\u3066\u308b\u3002\u4eca\u306fRecyclerView\u306b\u7f6e\u304d\u63db\u308f\u3063\u3066\u308b\u307f\u305f\u3044\u3002\u3048\u30fc\u3001\u3069\u3063\u3061\u4f7f\u3048\u3070\u3044\u3044\u3093\u3002\u8272\u3005\u898b\u308b\u3068RecyclerView\u306f\u30af\u30ea\u30c3\u30af\u30a4\u30d9\u30f3\u30c8\u3092\u81ea\u5206\u3067\u5b9f\u88c5\u3059\u308b\u3089\u3057\u3044\u3002\u305d\u308c\u306f\u81ea\u5206\u306b\u306f\u7121\u7406\u305d\u3046\u306a\u306e\u3067\u3001ListView\u306b\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/lifecalc.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-304\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/lifecalc-300x214.png\" alt=\"\" width=\"300\" height=\"214\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/lifecalc-300x214.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/lifecalc-768x548.png 768w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/lifecalc.png 839w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h5>string.xml<\/h5>\n<pre>&lt;resources&gt;\r\n    &lt;string name=\"app_name\"&gt;My Application&lt;\/string&gt;\r\n    &lt;string-array name=\"calc_menu\"&gt;\r\n        &lt;item&gt;BMI\u8a08\u7b97&lt;\/item&gt;\r\n        &lt;item&gt;\u65e5\u6570\u8a08\u7b97&lt;\/item&gt;\r\n        &lt;item&gt;\u73fe\u5e74\u9f62&lt;\/item&gt;\r\n        &lt;item&gt;\u6642\u7d66\u7d66\u4e0e\u8a08\u7b97&lt;\/item&gt;\r\n        &lt;item&gt;\u5b50\u4f9b\u306e\u80a5\u6e80&lt;\/item&gt;\r\n        &lt;item&gt;\u6d88\u8cbb\u7a0e&lt;\/item&gt;\r\n        &lt;item&gt;\u6642\u9593\u8a08\u7b97&lt;\/item&gt;\r\n        &lt;item&gt;\u9069\u6b63\u30fb\u7f8e\u5bb9\u30fb\u30e2\u30c7\u30eb\u4f53\u91cd&lt;\/item&gt;\r\n        &lt;item&gt;\u5e95\u8fba\u3068\u9ad8\u3055\u304b\u3089\u89d2\u5ea6\u3068\u659c\u8fba\u3092\u8a08\u7b97&lt;\/item&gt;\r\n        &lt;item&gt;\u5b50\u4f9b\u306e\u8eab\u9577\u4e88\u6e2c&lt;\/item&gt;\r\n    &lt;\/string-array&gt;\r\n&lt;\/resources&gt;<\/pre>\n<h5>activity_main.xml<\/h5>\n<pre>&lt;ListView\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    android:entries=\"@array\/calc_menu\"\/&gt;<\/pre>\n<p>\u3067\u3001\u4e00\u756a\u6700\u521d\u306e\u753b\u9762\u304c\u3067\u304d\u305f\u3002\u3068\u308a\u3042\u3048\u305aBMI\u3068\u3044\u3046\u3053\u3068\u3067\u305d\u3063\u3061\u306eActivity\u306e\u753b\u9762\u3092\u4f5c\u308b\u3002<\/p>\n<p><a href=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/bmi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-303\" src=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/bmi-300x214.png\" alt=\"\" width=\"300\" height=\"214\" srcset=\"https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/bmi-300x214.png 300w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/bmi-768x548.png 768w, https:\/\/dalomo.net\/blog\/wp-content\/uploads\/2018\/12\/bmi.png 839w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u307e\u3001\u3066\u304d\u3068\u30fc\u306b\u3002<\/p>\n<h4>\u30ea\u30b9\u30c8\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089BMI\u306b\u98db\u3076\u3088\u3046\u306b\u3059\u308b<\/h4>\n<h5>ListItemClickListener<\/h5>\n<pre>private class ListItemClickListener implements AdapterView.OnItemClickListener {\r\n    @Override\r\n    public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) {\r\n        Intent intent;\r\n\r\n        switch (position) {\r\n            case (0):\r\n                intent = new Intent(LifeCalcActivity.this, BMIActivity.class);\r\n                startActivity(intent);\r\n                break;\r\n\r\n            case (1):\r\n\r\n                break;\r\n        }\r\n    }\r\n}<\/pre>\n<p>\u3046\u30fc\u3093\u3068\u3001AdapterView\u304cListView\u3001View\u304cListView\u306eView(\u3053\u306e\u5834\u5408TextView\u304c\u53d6\u308c\u3066\u308b\u3002string_array\u304b\u3089\u3060\u304b\u3089\u304b\u306a?)\u3001position\u304c\u884c\u756a\u53f7\u3001id\u304c\u2026\u306a\u3093\u306eid\u3060\u308d\u3053\u308c\u3002\u307e\u3001\u3044\u3044\u3084\u3002\u3068\u308a\u3042\u3048\u305aposition\u3067switch\u3057\u3066\u307f\u305f\u3002<\/p>\n<h5>onCreate\u5185<\/h5>\n<pre>ListView listView = findViewById(R.id.calc_menu);\r\nlistView.setOnItemClickListener(new ListItemClickListener());<\/pre>\n<p>\u3093\u3067\u3001\u30ea\u30b9\u30ca\u306e\u8a2d\u5b9a\u3002<\/p>\n<h4>BMI\u8a08\u7b97<\/h4>\n<h5>\u753b\u9762\u306e\u51e6\u7406\u8272\u3005<\/h5>\n<pre>android:focusable=\"true\"\r\nandroid:focusableInTouchMode=\"true\"<\/pre>\n<p>\u6700\u521d\u753b\u9762\u4f5c\u3063\u305f\u969b\u3001\u8eab\u9577\u6b04\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u304c\u5f53\u305f\u3063\u3066\u305f\u306e\u3067\u3001TextView\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u3092\u8a2d\u5b9a\u3057\u3066EditText\u306e\u30d5\u30a9\u30fc\u30ab\u30b9\u3092\u5916\u3059\u3002<\/p>\n<pre>android:hint=\"@string\/body_height\"<\/pre>\n<p>\u5165\u529b\u8aac\u660e\u7528\u306bText\u3092\u5165\u529b\u3057\u3068\u3044\u305f\u3089\u3001\u30d5\u30a9\u30fc\u30ab\u30b9\u3057\u3066\u3082\u6b8b\u3063\u3066\u308b\u306e\u3067\u306a\u3093\u3058\u3083\u3053\u308a\u3083\u3001\u3068\u601d\u3063\u305f\u3089android:hint\u306b\u8a2d\u5b9a\u3059\u308b\u3093\u3060\u3063\u305f\u307f\u305f\u3044\u3002<\/p>\n<pre>android:inputType=\"numberDecimal\"<\/pre>\n<p>\u30ad\u30fc\u30dc\u30fc\u30c9\u304c\u6587\u5b57\u5165\u529b\u3067\u51fa\u3066\u304f\u308b\u306e\u3067\u3001\u6570\u5b57\u5165\u529b\u306b\u3059\u308b\u3002\u3053\u308c\u3067\u5165\u529b\u5236\u9650\u3082\u3067\u304d\u308b\u307f\u305f\u3044\u3002<\/p>\n<p>\u5165\u529b\u7d42\u4e86\u6642\u306b\u30d5\u30a9\u30fc\u30ab\u30b9\u304c\u5f53\u305f\u308a\u3063\u3071\u306a\u306e\u304c\u6c17\u306b\u98df\u308f\u306a\u3044\u3051\u3069\u3001\u6539\u5584\u65b9\u6cd5\u304c\u5206\u304b\u3089\u3093\u306e\u3067\u307b\u3063\u3068\u304f\u3002<\/p>\n<h5>\u8a08\u7b97\u3059\u308b<\/h5>\n<p>\u96fb\u5353\u4f5c\u3063\u305f\u3068\u304d\u306b\u898b\u306a\u304b\u3063\u305f\u3053\u3068\u306b\u3057\u305fBigDesimal\u3092\u4f7f\u3063\u3066\u307f\u308b\u3002<\/p>\n<pre>EditText etHeight;\r\nEditText etWeight;\r\nTextView tvResult;<\/pre>\n<pre>public void onClickCalc(View v) {\r\n    String result;\r\n\r\n    etHeight = findViewById(R.id.editTextHeight);\r\n    etWeight = findViewById(R.id.editTextWeight);\r\n    tvResult = findViewById(R.id.result_textView);\r\n\r\n    BigDecimal valueHeight = new BigDecimal(etHeight.getText().toString());\r\n    BigDecimal valueWeight = new BigDecimal(etWeight.getText().toString());\r\n\r\n    valueHeight = valueHeight.scaleByPowerOfTen(-2).pow(2);\r\n    result = valueWeight.divide(valueHeight, 2, RoundingMode.HALF_UP).toPlainString();\r\n\r\n    tvResult.setText(\"\u3042\u306a\u305f\u306eBMI\u306f\u2026\" + \"\\n\" + result);\r\n\r\n}<\/pre>\n<p>\u3053\u3093\u306a\u3002\u82e5\u5e72\u3081\u3093\u3069\u304f\u305b\u3047\u306a\u3002<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/YRgtPtAVMNY\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\u306a\u304b\u306a\u304b\u306b\u666e\u901a\u3060\u3002\u305d\u3057\u305f\u3089\u4eca\u5ea6\u306f\u8a08\u7b97\u7d50\u679c\u3092DB\u306b\u4fdd\u5b58\u3057\u3066\u304f\u3088\u3046\u306b\u3059\u308c\u3070\u3044\u3044\u306d\u3002\u3088\u3046\u3084\u304f\u3060\u306a\u3001\u8a18\u4e8b\u5206\u3051\u3088\u3063\u3068\u3002<\/p>\n<h4>\u53c2\u8003<\/h4>\n<p>[affi id=2]<\/p>\n<p><a href=\"https:\/\/keisan.casio.jp\/keisan\/ranking100.php\">https:\/\/keisan.casio.jp\/keisan\/ranking100.php<\/a><\/p>\n<p><a href=\"https:\/\/knowledge.moshimore.jp\/entry\/android_application_edittext_focus\">https:\/\/knowledge.moshimore.jp\/entry\/android_application_edittext_focus<\/a><\/p>\n<p><a href=\"https:\/\/akira-watson.com\/android\/edittext.html\">https:\/\/akira-watson.com\/android\/edittext.html<\/a><\/p>\n<p><a href=\"https:\/\/akira-watson.com\/android\/edittext_input_display.html\">https:\/\/akira-watson.com\/android\/edittext_input_display.html<\/a><\/p>\n<p><a href=\"https:\/\/monoworks.co.jp\/post\/android_develop_memo_2015111601\/\">https:\/\/monoworks.co.jp\/post\/android_develop_memo_2015111601\/<\/a><\/p>\n<p><a href=\"https:\/\/developer.android.com\/reference\/android\/widget\/TextView?hl=ja#attr_android:inputType\">https:\/\/developer.android.com\/reference\/android\/widget\/TextView?hl=ja#attr_android:inputType<\/a><\/p>\n<p><a href=\"https:\/\/qiita.com\/ota-meshi\/items\/967304d406d668febe1d\">https:\/\/qiita.com\/ota-meshi\/items\/967304d406d668febe1d<\/a><\/p>\n<p><a href=\"http:\/\/androidlab.blog119.fc2.com\/blog-entry-7.html\">http:\/\/androidlab.blog119.fc2.com\/blog-entry-7.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQLite Plugin\u3092\u63a2\u3057\u3066\u3044\u305f\u3089\u3001SQL Android\u3068\u3044\u3046Plugin\u3092\u898b\u3064\u3051\u305f\u3002\u306a\u3093\u304b\u3059\u3054\u3044\u4fbf\u5229\u305d\u3046!\u3068\u601d\u3063\u305f\u306e\u3067\u4f7f\u3063\u3066\u307f\u305f\u304f\u306a\u3063\u305f\u3002\u306e\u3067\u3001RDB\u3092\u4f7f\u3063\u305f\u30a2\u30d7\u30ea\u3092\u4f5c\u3063\u3066\u307f\u305f\u3044\u3002RDB\u306b\u95a2\u3057\u3066\u306f\u3001\u307b\u3068\u3093\u3069\u77e5\u8b58 &hellip; <a href=\"https:\/\/dalomo.net\/blog\/2018\/12\/23\/300\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":304,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[3,6,4,26],"class_list":["post-300","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-8","tag-android","tag-androidstudio","tag-4","tag-26"],"_links":{"self":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/comments?post=300"}],"version-history":[{"count":5,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/300\/revisions"}],"predecessor-version":[{"id":306,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/300\/revisions\/306"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media\/304"}],"wp:attachment":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media?parent=300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/categories?post=300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/tags?post=300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}