質問編集履歴
3
修正済みのコード省略
test
CHANGED
File without changes
|
test
CHANGED
@@ -19,40 +19,6 @@
|
|
19
19
|
|
20
20
|
|
21
21
|
```kotlin
|
22
|
-
|
23
|
-
class ListItem(val title: String) {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
var description: String = "No description"
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
constructor(title: String, description: String) : this(title) {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
this.description = description
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}
|
40
|
-
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
data class ViewHolder(
|
46
|
-
|
47
|
-
val titleView: EditText,
|
48
|
-
|
49
|
-
val descriptionView: Button,
|
50
|
-
|
51
|
-
val deleteIcon: Button
|
52
|
-
|
53
|
-
)
|
54
|
-
|
55
|
-
|
56
22
|
|
57
23
|
class MyArrayAdapter(context: Context, resource: Int) :
|
58
24
|
|
@@ -134,45 +100,11 @@
|
|
134
100
|
|
135
101
|
|
136
102
|
|
137
|
-
if (viewHolder.titleView.text != null) {
|
138
|
-
|
139
|
-
try {
|
140
|
-
|
141
|
-
val str = viewHolder.titleView.text.toString()
|
142
|
-
|
143
|
-
val out =
|
144
|
-
|
145
|
-
openFileOutput("test.txt", Context.MODE_PRIVATE)
|
146
|
-
|
147
|
-
out.write(str.toByteArray())
|
148
|
-
|
149
|
-
} catch (e: IOException) {
|
150
|
-
|
151
|
-
e.printStackTrace()
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
viewHolder.titleView.setTextColor(Color.parseColor("#808080"));
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
}
|
162
|
-
|
163
|
-
|
164
|
-
|
165
103
|
flag = false
|
166
104
|
|
167
105
|
|
168
106
|
|
169
107
|
} else {
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
viewHolder.titleView.isEnabled = false
|
174
|
-
|
175
|
-
viewHolder.descriptionView.text = "編集"
|
176
108
|
|
177
109
|
|
178
110
|
|
@@ -212,7 +144,7 @@
|
|
212
144
|
|
213
145
|
}
|
214
146
|
|
215
|
-
|
147
|
+
}
|
216
148
|
|
217
149
|
}
|
218
150
|
|
2
コードを追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -188,7 +188,33 @@
|
|
188
188
|
|
189
189
|
|
190
190
|
|
191
|
+
val arrayAdapter = MyArrayAdapter(this, 0).apply {
|
192
|
+
|
193
|
+
add(ListItem("", "編集"))
|
194
|
+
|
191
|
-
}
|
195
|
+
}
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
val ButtonTuika = findViewById<Button>(R.id.button_tuika)
|
200
|
+
|
201
|
+
val listView: ListView = findViewById(R.id.listview)
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
ButtonTuika.setOnClickListener {
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
listView.adapter = arrayAdapter
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
}
|
192
218
|
|
193
219
|
```
|
194
220
|
|
1
Markdown記法にするために変更します
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
|
20
20
|
|
21
|
+
```kotlin
|
22
|
+
|
21
23
|
class ListItem(val title: String) {
|
22
24
|
|
23
25
|
|
@@ -188,6 +190,8 @@
|
|
188
190
|
|
189
191
|
}
|
190
192
|
|
193
|
+
```
|
194
|
+
|
191
195
|
|
192
196
|
|
193
197
|
### 試したこと
|