質問編集履歴
2
MainActivity.javaのコードを載せました
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,9 +28,9 @@
|
|
28
28
|
|
29
29
|
### 該当のソースコード
|
30
30
|
|
31
|
-
![イメージ説明](a51743e57e2edc5651b88faccd8a368b.png)
|
32
31
|
|
33
|
-
|
32
|
+
|
33
|
+
|
34
34
|
|
35
35
|
ソースコード
|
36
36
|
|
1
MainActivity.javaのコードを載せました
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,7 +34,89 @@
|
|
34
34
|
|
35
35
|
ソースコード
|
36
36
|
|
37
|
-
``
|
37
|
+
``
|
38
|
+
|
39
|
+
package com.example.choice;
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
import androidx.appcompat.app.AppCompatActivity;
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
import android.os.Bundle;
|
48
|
+
|
49
|
+
import android.view.View;
|
50
|
+
|
51
|
+
import android.widget.EditText;
|
52
|
+
|
53
|
+
import android.widget.TextView;
|
54
|
+
|
55
|
+
import android.widget.Toast;
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
public class MainActivity extends AppCompatActivity {
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
String Answer = "れいめいき";
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
@Override
|
70
|
+
|
71
|
+
protected void onCreate(Bundle savedInstanceState) {
|
72
|
+
|
73
|
+
super.onCreate(savedInstanceState);
|
74
|
+
|
75
|
+
setContentView(R.layout.activity_main);
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
public void btn1(View v){
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
//idを取得
|
90
|
+
|
91
|
+
EditText text = (EditText)findViewById(R.id.textName);
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
String textArea;
|
96
|
+
|
97
|
+
textArea = text.getText().toString();
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
//入力された文字があっていればtoastを表示
|
106
|
+
|
107
|
+
if (textArea == Answer) {
|
108
|
+
|
109
|
+
Toast.makeText(this, "correct", Toast.LENGTH_LONG).show();
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
}
|
118
|
+
|
119
|
+
}
|
38
120
|
|
39
121
|
|
40
122
|
|