{"id":96,"date":"2018-11-03T00:07:26","date_gmt":"2018-11-02T15:07:26","guid":{"rendered":"https:\/\/dalomo.net\/blog\/?p=96"},"modified":"2018-11-03T00:07:26","modified_gmt":"2018-11-02T15:07:26","slug":"androidstudio%e3%81%a7%e9%9b%bb%e5%8d%93%e3%81%a7%e3%81%8d%e3%81%9f%e2%91%a1","status":"publish","type":"post","link":"https:\/\/dalomo.net\/blog\/2018\/11\/03\/96\/","title":{"rendered":"AndroidStudio\u3067\u96fb\u5353\u3067\u304d\u305f\u2461"},"content":{"rendered":"<h2>\u5fc3\u5909\u308f\u308a<\/h2>\n<p>\u6628\u65e5(\u4e00\u6628\u65e5\u306b\u306a\u3063\u305f)\u3067\u304d\u3042\u304c\u3063\u305f\u3053\u3068\u3067\u3001\u6e80\u8db3\u3057\u3066\u3066\u304d\u3068\u30fc\u306a<a href=\"https:\/\/dalomo.net\/blog\/2018\/11\/01\/88\/\">\u8a18\u4e8b<\/a>\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u3002<\/p>\n<p>\u3067\u3082\u3084\u3063\u3071\u308a\u3001\u521d\u3081\u3066\u3061\u3083\u3093\u3068\u3067\u304d\u3042\u304c\u3063\u305f\u30a2\u30d7\u30ea\u3060\u3057<\/p>\n<p>\u8003\u3048\u305f\u3053\u3068\u3068\u304b\u3001\u5206\u304b\u3093\u306a\u3044\u3053\u3068\u3068\u304b\u6b8b\u3057\u3068\u3053\u3046\u3068\u601d\u3046\u3002<\/p>\n<p>\u30bd\u30fc\u30b9\u306f<a href=\"https:\/\/dalomo.net\/blog\/2018\/11\/01\/86\/\">\u3053\u3063\u3061<\/a>\u3002\u96fb\u5353\u306e\u4e2d\u8eab\u3068\u304b\u306f\u66f8\u3051\u308b\u307b\u3069\u8003\u3048\u3066\u306a\u3044\u3002<\/p>\n<h3>import<\/h3>\n<pre>import android.support.v7.app.AppCompatActivity;\r\nimport android.os.Bundle;\r\nimport android.view.View;\r\nimport android.widget.Button;\r\nimport android.widget.TextView;\r\n<\/pre>\n<p>\u305d\u3082\u305d\u3082import\u3063\u3066\u2026\u306a\u306b\u2026?\u3068\u3044\u3046\u30ec\u30d9\u30eb\u3060\u3063\u305f\u306e\u3067<\/p>\n<p>\u30b3\u30fc\u30c9\u3067\u300c\u3053\u3053\u30a2\u30ab\u30f3\u305e\u300d\u3063\u3066\u8a00\u308f\u308c\u305f\u6642\u306bAlt+Enter\u3092<\/p>\n<p>\u62bc\u3059\u3068\u52dd\u624b\u306b\u8ffd\u52a0\u3055\u308c\u3066\u3044\u3063\u305f\u3002\u3079\u3093\u308a\u3002<\/p>\n<p>\u672a\u3060\u306b\u4f55\u306e\u70ba\u306b\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u306e\u304b\u5206\u304b\u3089\u306a\u3044\u3063\u3066\u3044\u3046\u3002<\/p>\n<p>view\u3068\u304bwidget\u3068\u304b\u3064\u3044\u3066\u308b\u304b\u3089\u3053\u308c\u3089\u4f7f\u3046\u306e\u306b\u5fc5\u8981\u306a\u3093\u3060\u308d\u3046\u3002<\/p>\n<h3>\u5909\u6570\u306e\u5ba3\u8a00<\/h3>\n<pre>public class MainActivity extends AppCompatActivity {\r\n    String opText;\r\n    String outText;\r\n    boolean afterOp;\r\n    boolean isStacked;\r\n    Float StackedValue;\r\n<\/pre>\n<p>\u5909\u6570\u3092\u66f8\u304f\u4f4d\u7f6e\u3082\u5206\u304b\u3063\u3066\u306a\u304b\u3063\u305f\u3002<\/p>\n<p>\u6700\u521donClick\u306e\u4e2d\u3067\u5ba3\u8a00\u3057\u3066\u305f\u306e\u3060\u304c\u3001\u305d\u3046\u3059\u308b\u3068\u5909\u6570\u306b\u5024\u304c\u4fdd\u6301\u3055\u308c\u3066\u3044\u306a\u3044\u3002<\/p>\n<p>boolean\u306f\u3044\u3064\u3082false\u3060\u3057\u3001StackedValue\u306f\u3044\u3064\u3082\u7a7a\u3002<\/p>\n<p>\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3054\u3068\u306b\u7a81\u98db\u306a\u6570\u5b57\u304c\u8868\u793a\u3055\u308c\u308b\u3057\u3001\u6700\u60aa\u843d\u3061\u308b\u3002<\/p>\n<p>\u3042\u3001\u3053\u3053\u306b\u66f8\u3051\u3070\u3044\u3044\u3093\u3060\u3063\u3066\u5206\u304b\u3063\u305f\u6642\u306f\u8151\u306b\u843d\u3061\u305f\u611f\u304c\u3059\u3054\u304b\u3063\u305f\u3002<\/p>\n<p>Activity\u5168\u4f53\u3067\u4f7f\u3046\u5909\u6570\u306f\u3053\u3053\u306b\u66f8\u3051\u3070\u3044\u3044\u3093\u3060\u306d\u3002<\/p>\n<p>\u3042\u3068\u521d\u671f\u5316\u3057\u3066\u306a\u3044\u3001\u305d\u3046\u3044\u3048\u3070\u3002\u3067\u3082\u52d5\u304f\u3002\u3059\u3054\u3044\u3002<\/p>\n<h3>\u30dc\u30bf\u30f3\u306b\u30ea\u30b9\u30ca\u3092\u8a2d\u5b9a<\/h3>\n<pre>    @Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        setContentView(R.layout.activity_main);\r\n\r\n        Button bt1Click = findViewById(R.id.button1);\r\n        ButtonClick bt1listener = new ButtonClick();\r\n        bt1Click.setOnClickListener(bt1listener);\r\n\/\/\u7701\u7565\r\n<\/pre>\n<p>\u3053\u3053\u304c\u5197\u9577\u306a\u6c17\u304c\u3057\u3066\u308b\u3002<\/p>\n<p>\u753b\u9762\u306e\u4f5c\u308a\u65b9\u3092\u3082\u3063\u3068\u8abf\u3079\u308c\u3070\u3001\u7c21\u5358\u306b\u66f8\u3051\u308b\u3093\u3058\u3083\u306a\u3044\u3060\u308d\u304b\u3002<\/p>\n<p>\u305f\u3060\u4eca\u306f\u3053\u308c\u3057\u304b\u77e5\u3089\u3093\u306e\u3067\u3001\u3053\u3046\u3084\u3063\u305f\u3002<\/p>\n<p>\u3042\u3068@Override\u306e\u610f\u5473\u304c\u5206\u304b\u3089\u306a\u3044\u2026\u3002\u3082\u3046\u5168\u7136\u5206\u304b\u3089\u306a\u3044\u3002<\/p>\n<p>\u6700\u521d\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u65b0\u898f\u4f5c\u6210\u3057\u305f\u6642\u306b\u3042\u3063\u305f\u306e\u3067\u305d\u306e\u307e\u307e\u306b\u3057\u3066\u308b\u3002<\/p>\n<p>\u3044\u3064\u304b\u8b0e\u304c\u89e3\u3051\u308b\u3093\u3060\u308d\u3046\u304b\u3002<\/p>\n<h3>\u3053\u3053\u304c\u30dc\u30bf\u30f3\u306e\u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u306a\u306e?<\/h3>\n<pre>private class ButtonClick implements View.OnClickListener{\r\n    TextView output = findViewById(R.id.tvOutput);\r\n<\/pre>\n<p>\u3053\u308c\u306f\u3082\u3046\u3001\u3053\u3046\u66f8\u3051\u3070TextView\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3063\u3066\u3044\u3046\u306e\u3092\u305d\u306e\u307e\u307e\u66f8\u3044\u305f\u3002<\/p>\n<p>\u305f\u3060\u66f8\u304f\u5834\u6240\u306f\u679c\u305f\u3057\u3066\u3053\u3053\u3067\u3088\u304b\u3063\u305f\u306e\u304b\u3001\u52d5\u3044\u3066\u308b\u304b\u3089\u3044\u3044\u3093\u3060\u308d\u3046\u3051\u3069<\/p>\n<p>\u78ba\u8a3c\u304c\u3042\u3063\u3066\u3053\u3046\u3057\u3066\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u306e\u3067\u3001\u5b8c\u5168\u306b\u624b\u63a2\u308a\u3002<\/p>\n<h3>\u95a2\u6570AppendTexts<\/h3>\n<pre>void appendTexts(String t){\r\n    outText = output.getText().toString();\r\n\r\n    if (!afterOp &amp;&amp; !(outText.equals(\"0\"))) {\r\n        t = outText + t;\r\n    }else if(t.equals(\".\")) {\r\n        t = \"0\" + t;\r\n    }\r\n\r\n    output.setText(t);\r\n    afterOp = false;\r\n}<\/pre>\n<p>\u53c2\u8003\u306b\u3057\u305f\u30b5\u30a4\u30c8\u304b\u3089\u5f15\u3063\u5f35\u3063\u3066\u304d\u3066\u3044\u308b\u3002<\/p>\n<p>\u305f\u3060\u3001\u305d\u306e\u307e\u307e\u5f15\u3063\u5f35\u3063\u3066\u304d\u305f\u3089\u3001\u300c0\u300d\u306e\u5f8c\u306b\u300c1\u300d\u3092\u62bc\u3059\u3068\u300c01\u300d\u3063\u3066<\/p>\n<p>\u8868\u793a\u3055\u308c\u3061\u3083\u3063\u305f\u306e\u3067\u3001!(outText.equals(&#8220;0&#8221;))\u30670\u3092\u9664\u5916\u3002<\/p>\n<p>\u3042\u3068\u8868\u793a\u304c\u300c0\u300d\u306e\u6642\u306b\u300c\uff0e\u300d\u3092\u62bc\u3059\u3068\u300c\uff0e123\u300d\u307f\u305f\u3044\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u306e\u3067<\/p>\n<p>\u305d\u308c\u7528\u306b\u51e6\u7406\u3092\u5165\u308c\u305f\u3002<\/p>\n<p>\u6587\u5b57\u5217\u306e\u6bd4\u8f03\u3067\u300c==\u300d\u3092\u4f7f\u3063\u305f\u3089<\/p>\n<blockquote><p>String values are compared using &#8216;==&#8217;, not &#8216;equals()&#8217; less&#8230; (Ctrl+F1)<br \/>\nReports any use of == or != to test for String equality, rather than the equals() method.<\/p><\/blockquote>\n<p>\u300cequals\u300d\u4f7f\u3048\u3063\u3066\u6012\u3089\u308c\u305f\u3002<\/p>\n<p>\u3042\u3068\u591a\u5206\u5168\u7136\u5206\u304b\u3063\u3066\u306a\u3044\u306e\u304c\u95a2\u6570\u306e\u5ba3\u8a00\u65b9\u6cd5\u306d\u3002<\/p>\n<p>\u2191\u306b\u306a\u308b\u4ee5\u524d\u306fvoid\u306e\u524d\u306bPublic\u3063\u3066\u5165\u3063\u3066\u305f\u3002<\/p>\n<p>\u300cjava \u95a2\u6570 \u4f5c\u308a\u65b9\u300d\u3068\u304b\u3067\u30b0\u30b0\u3063\u305f\u30b5\u30a4\u30c8\u306b\u305d\u3046\u8f09\u3063\u3066\u305f\u304b\u3089\u306d\u3002<\/p>\n<p>\u3067\u3082Public\u3063\u3066\u5165\u3063\u3066\u308b\u3068<\/p>\n<blockquote><p>Access can be package-private less&#8230; (Ctrl+F1)<br \/>\nThis inspection reports all fields, methods or classes, found in the specified inspection scope, that may have their access modifier narrowed down.<\/p><\/blockquote>\n<p>\u3064\u3063\u3066\u3055\u3001\u6012\u3089\u308c\u308b\u306e\u3002\u591a\u5206\u30b9\u30b3\u30fc\u30d7\u304c\u9069\u5207\u3058\u3083\u306d\u3048\u3088?\u3064\u3063\u3066\u308b\u3093\u3060\u308d\u3046\u3051\u3069<\/p>\n<p>\u3058\u3083\u3042\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u306e?\u3063\u3066\u3055\u3001\u306a\u308b\u3058\u3083\u306a\u3044\u3002\u30b9\u30b3\u30fc\u30d7\u306a\u3093\u3066\u307e\u3060\u5206\u304b\u3063\u3066\u306a\u3044\u3093\u3060\u3057\u3002<\/p>\n<p>\u3067\u3001\u3068\u308a\u3042\u3048\u305a\u53d6\u3063\u3066\u307f\u305f\u3089\u6d88\u3048\u305f\u3002\u306e\u3067\u3001\u4e00\u5b89\u5fc3\u3002<\/p>\n<p>\u6b8b\u308b\u8b0e\u306fvoid\u3060\u3002\u3053\u308c\u4e00\u4f53\u306a\u3093\u306e\u70ba\u306b\u4ed8\u3044\u3066\u308b\u3093\u3060\u308d\u3046\u3002<\/p>\n<p>\u305d\u3046\u3044\u3048\u3070\u3001\u3053\u308c\u304c\u521d\u3081\u3066\u4f5c\u3063\u305f\u95a2\u6570\u306a\u3093\u3060\u306a\u3041\u3002<\/p>\n<p>VBA\u3067\u3082\u4f7f\u3063\u305f\u3053\u3068\u306a\u304b\u3063\u305f\u308a\u3059\u308b\u3002<\/p>\n<p>\u540c\u3058\u3088\u3046\u306a\u51e6\u7406\u306f\u540c\u3058\u30b3\u30fc\u30c9\u3092\u30b3\u30d4\u30da\u3057\u3066\u4f7f\u3044\u307e\u308f\u3057\u3066\u305f\u3002<\/p>\n<p>\u305d\u308c\u306b\u6bd4\u3079\u308c\u3070\u3060\u3044\u3076\u9032\u6b69\u3057\u305f\u306a\u3041\u3002<\/p>\n<h3>\u95a2\u6570Calculation<\/h3>\n<pre>void Calculation(String o, Float s){\r\n    Float r = 0.0f;\r\n\r\n    if(o.equals(\"\uff0b\")){\r\n        r = s + Float.parseFloat(output.getText().toString());\r\n\r\n    }else if(o.equals(\"\uff0d\")){\r\n        r = s - Float.parseFloat(output.getText().toString());\r\n\r\n    }else if(o.equals(\"\u00d7\")){\r\n        r = s * Float.parseFloat(output.getText().toString());\r\n\r\n    }else if(o.equals(\"\u00f7\")) {\r\n        r = s \/ Float.parseFloat(output.getText().toString());\r\n    }\r\n\r\n    if(r == r.intValue() ){\r\n        output.setText(String.valueOf(r.intValue()));\r\n    }else{\r\n        output.setText(r.toString());\r\n    }\r\n}<\/pre>\n<p>\u8a08\u7b97\u3059\u308b\u95a2\u6570\uff5e\uff01<\/p>\n<p>Float.parseFloat(output.getText().toString())\u3067\u8868\u793a\u304b\u3089Text\u53d6\u5f97\u3057\u3066String\u306b\u5909\u63db\u3057\u305f\u5f8c<\/p>\n<p>Float\u306b\u578b\u5909\u63db\u2026\u306e\u3064\u3082\u308a\u3002\u3053\u308c\u3082\u3063\u3068\u77ed\u304f\u66f8\u3051\u306a\u3044\u306e\u304b\u306a\u3002<\/p>\n<p>\u3067\u3082\u3068\u308a\u3042\u3048\u305a\u3084\u308a\u305f\u3044\u3053\u3068\u304c\u3067\u304d\u3066\u308b\u3093\u3067\u3044\u3044\u304b\u306a\u3002<\/p>\n<p>\u5f15\u6570\u306fButton\u306e\u6587\u5b57\u3068TextView\u306e\u6570\u5b57\u3060\u3063\u305f\u306a\u78ba\u304b\u3002<\/p>\n<p>\u5f15\u65702\u500b\u306e\u3082\u4f5c\u308c\u305f\u3002\u6700\u9ad8\u3084\u306d\u3002<\/p>\n<p>1\u500b\u76ee\u306eif\u306e\u3068\u3053\u308d\u3067<\/p>\n<blockquote><p>&#8216;if&#8217; statement replaceable with &#8216;switch&#8217; statement less&#8230; (Ctrl+F1)<br \/>\nReports any if statements with which can be replaced by a switch statement. This inspection will automatically suggest string switches when the project language level is Java 7 or higher.<\/p><\/blockquote>\n<p>Switch\u6587\u3082\u66f8\u3051\u306a\u3044\u306e?\u3077\u3077\u3077w\u3063\u3066\u8a00\u308f\u308c\u3066\u308b\u3051\u3069\u7121\u8996\u3057\u3066\u308b\u3002<\/p>\n<p>\u3042\u3001\u3042\u3068AppendTexts\u306epublic\u3082\u518d\u3073\u3002<\/p>\n<p>2\u500b\u76ee\u306eif\u306f\u8a08\u7b97\u7d50\u679c\u304c\u6574\u6570\u5024\u3060\u3063\u305f\u3068\u304d\u306b\u3001\u300c2.0\u300d\u3063\u3066\u5c0f\u6570\u90e8\u5206\u3092\u8868\u793a<\/p>\n<p>\u3055\u305b\u308b\u3093\u3058\u3083\u306a\u304f\u3001\u300c2\u300d\u3063\u3066\u8868\u793a\u3055\u305b\u305f\u3044\u304c\u305f\u3081\u306b\u5165\u308c\u3066\u308b\u3002<\/p>\n<p>output.setText(r.toString());\u306e\u3068\u3053\u308d\u3067<\/p>\n<blockquote><p>Number formatting does not take into account locale settings. Consider using String.format instead. less&#8230; (Ctrl+F1)<br \/>\nWhen calling TextView#setText * Never call Number#toString() to format numbers; it will not handle fraction separators and locale-specific digits properly. Consider using String#format with proper format specifications (%d or %f) instead. * Do not pass a string literal (e.g. &#8220;Hello&#8221;) to display text. Hardcoded text can not be properly translated to other languages. Consider using Android resource strings instead. * Do not build messages by concatenating text chunks. Such messages can not be properly translated. Issue id: SetTextI18n More info: http:\/\/developer.android.com\/guide\/topics\/resources\/localization.html<\/p><\/blockquote>\n<p>\u3066\u3001\u6012\u3089\u308c\u308b\u3093\u3067\u3059\u3051\u3069\u3088\u304f\u5206\u304b\u3093\u306a\u3044\u3093\u3067\u3059\u3002<\/p>\n<p>String.format\u4f7f\u3048\u3088\u3063\u3066\u8a00\u308f\u308c\u3066\u308b\u306e\u304b\u306a\u3002\u3067\u3082\u3001\u3053\u306e\u4f7f\u3044\u65b9\u3067\u3061\u3083\u3093\u3068<\/p>\n<p>\u6574\u5f62\u3055\u308c\u308b\u3088\u3046\u306a\u5f15\u6570\u304c\u5206\u304b\u3089\u306a\u304b\u3063\u305f\u3002\u307e\u3041\u3001\u52d5\u3044\u3066\u308b\u306e\u3067\u2026\u3002<\/p>\n<p>\u4eca\u601d\u3063\u305f\u3093\u3060\u3051\u3069<\/p>\n<pre>void Calculation(String o, Float s){\r\n    Float r = 0.0f;\r\n    Float t = Float.parseFloat(output.getText().toString());\r\n\r\n    if(o.equals(\"\uff0b\")){\r\n        r = s + t;\r\n\r\n    }else if(o.equals(\"\uff0d\")){\r\n        r = s - t;\r\n\r\n    }else if(o.equals(\"\u00d7\")){\r\n        r = s * t;\r\n\r\n    }else if(o.equals(\"\u00f7\")) {\r\n        r = s \/ t;\r\n    }\r\n\r\n    if(r == r.intValue() ){\r\n        output.setText(String.valueOf(r.intValue()));\r\n    }else{\r\n        output.setText(r.toString());\r\n    }\r\n}<\/pre>\n<p>\u3068\u304b\u306e\u304c\u304b\u3063\u3053\u3044\u3044\u304b\u306a\u3002\u597d\u307f\u304b\u3002<\/p>\n<h3>onClick\u30e1\u30bd\u30c3\u30c9<\/h3>\n<pre>public void onClick(View view) {\r\n    String apText;\r\n    int id = view.getId();\r\n    Button btn = (Button) view;<\/pre>\n<p>apText\u3063\u3066\u306a\u3093\u3067\u3053\u3053\u3067\u5ba3\u8a00\u3057\u3066\u308b\u3093\u3060\u308d\u3046\u3002\u306a\u3093\u3068\u306a\u304f\u3001\u304b\u306a\u3002<\/p>\n<p>view.getId();\u3067\u62bc\u3055\u308c\u305f\u30dc\u30bf\u30f3\u306eid\u3092\u53d6\u3063\u3066\u304d\u3066\u3001switch\u3067\u632f\u308b\u65b9\u6cd5\u3092\u53d6\u308b\u3053\u3068\u306b\u3002<\/p>\n<p>\u3042\u3068Button\u306eText\u3092\u53d6\u5f97\u3057\u305f\u3044\u306e\u3067view\u304b\u3089\u30ad\u30e3\u30b9\u30c8\u3002\u5168\u90e8\u53d7\u3051\u58f2\u308a\u3067\u3059\u3002<\/p>\n<h3>\u6570\u5b57\u30dc\u30bf\u30f3<\/h3>\n<pre>switch(id){\r\n    case R.id.button0:\r\n    case R.id.button1:\r\n    case R.id.button2:\r\n    case R.id.button3:\r\n    case R.id.button4:\r\n    case R.id.button5:\r\n    case R.id.button6:\r\n    case R.id.button7:\r\n    case R.id.button8:\r\n    case R.id.button9:\r\n        apText = btn.getText().toString();\r\n        appendTexts(apText);\r\n        break;<\/pre>\n<p>case\u3092\u3082\u3063\u3068\u304d\u308c\u3044\u306b\u66f8\u3051\u306a\u3044\u306e\u304b\u306a\u3002\u306a\u3093\u304b\u3042\u308a\u305d\u3046\u3060\u3051\u3069\u3002<\/p>\n<p>for\u3067\u56de\u3059\u3068\u304b?<\/p>\n<p>btn.getText().toString();\u3067Button\u306eText\u3092\u53d6\u5f97\u3057\u3066appendTexts\u306b\u6e21\u3057\u3066\u308b\u3060\u3051\u3002<\/p>\n<p>Button\u306eText\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u898b\u3064\u3051\u308b\u307e\u3067\u306f<\/p>\n<p>0\uff5e9\u307e\u3067\u306b\u540c\u3058\u3088\u3046\u306a\u30b3\u30fc\u30c9\u304c\u4e26\u3093\u3067\u305f\u306a\u3041\u2026<\/p>\n<h3>\u6f14\u7b97\u5b50\u30dc\u30bf\u30f3(+-*\/)<\/h3>\n<pre>case R.id.buttonplus:\r\ncase R.id.buttonminus:\r\ncase R.id.buttonby:\r\ncase R.id.buttondiv:\r\n    if(isStacked) {\r\n        Calculation(opText, StackedValue);\r\n    }\r\n\r\n    StackedValue = Float.parseFloat(output.getText().toString());\r\n    isStacked = true;\r\n    afterOp = true;\r\n    opText = btn.getText().toString();\r\n    break;<\/pre>\n<p>\u3053\u3053\u3067\u7d50\u69cb\u8a70\u307e\u3063\u305f\u3002<\/p>\n<p>opText\u306b\u62bc\u3055\u308c\u305f\u6f14\u7b97\u5b50\u3092\u4ee3\u5165\u3057\u3066\u304a\u304f\u308f\u3051\u3060\u3051\u3069<\/p>\n<p>\u6700\u521dcase\uff5eif(isStacked)\u306e\u9593\u306b\u66f8\u3044\u3066\u3044\u305f\u3002<\/p>\n<p>\u305d\u3046\u3059\u308b\u3068\u4f8b\u3048\u3070\u300110+30-20\u3068\u3044\u3046\u8a08\u7b97\u3092\u3059\u308b\u3068\u304d\u300c-\u300d\u3092\u62bc\u3057\u305f\u969b\u306b<\/p>\n<p>\u672c\u6765\u3067\u3042\u308c\u307040\u3068\u8868\u793a\u3055\u308c\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u306e\u3060\u304c-20\u3068\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3046\u3002<\/p>\n<p>StackedValue\u306b10\u304c\u5165\u3063\u3066\u3044\u3066\u3001\u8868\u793a\u304c30\u3002\u3053\u306e\u72b6\u614b\u3067\u300c-\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068<\/p>\n<p>10-30\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3068\u3044\u3046\u308f\u3051\u3060\u3002<\/p>\n<p>\u3053\u306e\u6642\u70b9\u3067\u306f\u300c=\u300d\u3092\u5b9f\u88c5\u3057\u3066\u3044\u306a\u304b\u3063\u305f\u70ba\u304b\u3001\u3069\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u3069\u306e\u6f14\u7b97\u5b50\u3092<\/p>\n<p>\u4f7f\u3046\u3001\u3068\u3044\u3046\u3053\u3068\u304c\u304d\u3061\u3093\u3068\u7406\u89e3\u3057\u3066\u7d44\u307f\u7acb\u3066\u3089\u308c\u3066\u3044\u306a\u304b\u3063\u305f\u3002<\/p>\n<p>\u7d50\u679c\u3001\u6f14\u7b97\u5b50\u4ee3\u5165\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3092Calculation\u30e1\u30bd\u30c3\u30c9\u547c\u3073\u51fa\u3057\u306e\u5f8c\u306b\u3059\u308b\u3053\u3068\u3067<\/p>\n<p>\u4e8b\u306a\u304d\u3092\u5f97\u305f\u3002\u8a2d\u8a08\u304b\u3089\u3084\u3063\u3066\u3044\u306a\u3044\u3068\u3084\u3063\u3071\u30c0\u30e1\u306a\u3093\u3060\u306a\u3041\u3068\u601d\u3063\u305f\u3002\u3061\u3047\u3002<\/p>\n<h3>\u6f14\u7b97\u5b50\u30dc\u30bf\u30f3(=)<\/h3>\n<pre>case R.id.buttonequal:\r\n    if(isStacked){\r\n        Calculation(opText,StackedValue);\r\n    }\r\n\r\n    isStacked = false;\r\n    afterOp = true;\r\n    break;<\/pre>\n<p>\u524d\u8a18\u306e\u4e8b\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u7279\u306b\u60a9\u307e\u305a\u3002<\/p>\n<p>\u4eca\u3061\u3087\u3063\u3068\u601d\u3063\u305f\u306e\u304c\u3001\u3053\u3053\u3067isStacked\u3092false\u306b\u3057\u3068\u304f\u306e\u304c\u6b63\u3057\u3044\u306e\u304b\u3002<\/p>\n<p>StackedValue\u306e\u5024\u3092\u66f4\u65b0\u3059\u308b\u3079\u304d\u306a\u3093\u3058\u3083\u306a\u3044\u304b\u3068\u304b\u3002<\/p>\n<p>\u3042\u3068\u3067true\u306b\u3057\u305f\u6642\u3001\u3069\u3093\u306a\u4e8b\u304c\u8d77\u3053\u308b\u304b\u8a66\u305d\u3063\u3068\u3002<\/p>\n<p>\u3066\u3044\u3046\u304b\u672c\u7269\u306e\u96fb\u5353\u3068\u6bd4\u3079\u308a\u3083\u3044\u3044\u306e\u304b\u3002<\/p>\n<h3>\u300c\uff0e\u300d\u30dc\u30bf\u30f3<\/h3>\n<pre>case R.id.buttonperiod:\r\n    String dplText;\r\n    dplText = output.getText().toString();\r\n\r\n    if (!dplText.contains(\".\")){\r\n        appendTexts(\".\");\r\n    }\r\n    break;<\/pre>\n<p>\u8868\u793a\u6587\u5b57\u5217\u3092\u53d6\u3063\u3066\u304d\u3066\u3001\u300c\uff0e\u300d\u304c\u542b\u307e\u308c\u3066\u306a\u304b\u3063\u305f\u3089\u300c\uff0e\u300d\u3092\u3064\u306a\u3052\u308b\u3068\u3002<\/p>\n<p>.contains()\u3063\u3066\u3044\u3046\u306e\u3092\u899a\u3048\u307e\u3057\u305f^^<\/p>\n<h3>C\u30dc\u30bf\u30f3<\/h3>\n<pre>case R.id.buttonc:\r\n    output.setText(\"0\");\r\n    isStacked = false;\r\n    afterOp = false;\r\n    StackedValue = null;\r\n    break;<\/pre>\n<p>\u5909\u6570\u3068TextView\u306e\u8868\u793a\u3092\u521d\u671f\u5316\u3057\u3066\u3042\u3052\u308b\u3002<\/p>\n<p>\u306a\u3093\u3068\u306a\u304fStackedValue\u3092null\u3067\u521d\u671f\u5316\u3057\u3066\u3057\u307e\u3063\u3066\u308b\u3093\u3060\u3051\u3069<\/p>\n<p>\u3053\u308c\u3067\u3044\u3044\u3093\u3060\u308d\u3046\u304b\u3002\u3053\u308c\u3058\u3083\u30c0\u30e1\u3060\u3063\u305f\u5834\u5408\u306e\u7406\u7531\u3092\u77e5\u308a\u305f\u3044\u306a\u3002<\/p>\n<p>0.0f\u3068\u304b\u306e\u65b9\u304c\u3044\u3044\u306e\u304b\u306a\u3002\u3046\u3080\u3080\u3002<\/p>\n<h3>\u305d\u306e\u4ed6<\/h3>\n<p>\u6f14\u7b97\u5b50\u3092\u9023\u7d9a\u3067\u62bc\u3057\u305f\u3068\u304d\u306e\u6319\u52d5\u304c\u5909\u304b\u3082\u3002<\/p>\n<p>\u4f8b\u3048\u30703+-+\u3068\u62bc\u3057\u305f\u6642\u306b3\u21923\u21926\u21920\u3068\u306a\u308b\u3002<\/p>\n<p>\u7406\u7531\u306f\u308f\u304b\u308b\u3051\u3069\u76f4\u3057\u65b9\u304c\u5fae\u5999\u3060\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>0\u9664\u7b97\u306e\u51e6\u7406\u3082\u3064\u3051\u3066\u306a\u3044\u3002<\/p>\n<p>\u305f\u3060\u3084\u3063\u3066\u307f\u305f\u3089\u8868\u793a\u304c\u300cInfinity\u300d\u306b\u306a\u3063\u305f\u306e\u3067<\/p>\n<p>\u304b\u3063\u3053\u3044\u3044\u3068\u601d\u3063\u3066\u305d\u306e\u307e\u307e\u306b\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u30c7\u30d0\u30c3\u30b0\u306e\u3084\u308a\u65b9\u3092\u899a\u3048\u305f\u3002\u3053\u308c\u304c\u4e00\u756a\u5927\u304d\u3044\u304b\u3082\u3002<\/p>\n<p>VBA\u3067\u306fF8\u3092\u62bc\u3059\u30681\u884c\u305a\u3064\u51e6\u7406\u304c\u78ba\u8a8d\u3067\u304d\u3066\u3001\u628a\u63e1\u3057\u3084\u3059\u304b\u3063\u305f\u3002<\/p>\n<p>Android\u3067\u306f\u5b9f\u6a5f\u3067\u52d5\u304b\u3059\u4ee5\u5916\u306e\u3084\u308a\u65b9\u3092\u77e5\u3089\u3093\u304b\u3063\u305f\u306e\u3067<\/p>\n<p>\u628a\u63e1\u3057\u3065\u3089\u3044\u306a\u3041\u3068\u601d\u3063\u3066\u305f\u3002\u3061\u3083\u3093\u3068\u63a2\u3059\u3079\u304d\u3088\u306d\u2026\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u304b\u306a\uff01<\/p>\n<p>\u3044\u304b\u306b\u81ea\u5206\u304c\u5206\u304b\u3063\u3066\u306a\u3044\u3067\u4f5c\u3063\u3066\u308b\u304b\u304c\u5206\u304b\u3063\u305f\u3060\u3051\u3067\u3082\u826f\u3057\uff01<\/p>\n<p>\u6b21\u306f\u30ea\u30d0\u30fc\u30b7\u3060\u30011\u5e74\u3050\u3089\u3044\u304b\u306a\u3041\uff5e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5fc3\u5909\u308f\u308a \u6628\u65e5(\u4e00\u6628\u65e5\u306b\u306a\u3063\u305f)\u3067\u304d\u3042\u304c\u3063\u305f\u3053\u3068\u3067\u3001\u6e80\u8db3\u3057\u3066\u3066\u304d\u3068\u30fc\u306a\u8a18\u4e8b\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u3002 \u3067\u3082\u3084\u3063\u3071\u308a\u3001\u521d\u3081\u3066\u3061\u3083\u3093\u3068\u3067\u304d\u3042\u304c\u3063\u305f\u30a2\u30d7\u30ea\u3060\u3057 \u8003\u3048\u305f\u3053\u3068\u3068\u304b\u3001\u5206\u304b\u3093\u306a\u3044\u3053\u3068\u3068\u304b\u6b8b\u3057\u3068\u3053\u3046\u3068\u601d\u3046\u3002 \u30bd\u30fc\u30b9\u306f\u3053\u3063\u3061\u3002\u96fb\u5353 &hellip; <a href=\"https:\/\/dalomo.net\/blog\/2018\/11\/03\/96\/\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[9],"tags":[3,6,4,5],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-9","tag-android","tag-androidstudio","tag-4","tag-5"],"_links":{"self":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/96","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=96"}],"version-history":[{"count":1,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/96\/revisions"}],"predecessor-version":[{"id":97,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/posts\/96\/revisions\/97"}],"wp:attachment":[{"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/media?parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/categories?post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalomo.net\/blog\/wp-json\/wp\/v2\/tags?post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}