質問編集履歴
5
質問の説明の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
家計簿アプリを作成しています。家計簿アプリでは月ごとの収支を一覧表示させたいと考えています。家計簿の収支データはもちろん2018年の11月のデータもあれば2018年の12月のデータも格納されていると仮定します。DatePickerDialogで年月を選択し(2018/12と選択したとします)、OKと押したときに2018/12
|
1
|
+
家計簿アプリを作成しています。家計簿アプリでは月ごとの収支を一覧表示させたいと考えています。家計簿の収支データはもちろん2018年の11月のデータもあれば2018年の12月のデータも格納されていると仮定します。DatePickerDialogで年月を選択し(2018/12と選択したとします)、OKと押したときに2018/12で曖昧検索をし、2018年の12月のデータのみ一覧表示させたいと考えています。DatePickerDialogを使って検索値となる2018/12のデータは取ってこれるのですが、DatePickerDialogの処理を書く場所と書き方がよくわからず困っています。![イメージ説明](ca8b4a7bbadd4afce6cb6b16c19de4c2.png)
|
2
2
|
|
3
3
|
どなたかご教授お願いします。
|
4
4
|
|
4
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
```kotlin
|
8
8
|
|
9
|
-
package com.example.
|
9
|
+
package com.example.username.kakeibo
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -216,7 +216,7 @@
|
|
216
216
|
|
217
217
|
```kotlin
|
218
218
|
|
219
|
-
package com.example.
|
219
|
+
package com.example.username.kakeibo
|
220
220
|
|
221
221
|
|
222
222
|
|
3
更新しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,398 +4,418 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
+
```kotlin
|
8
|
+
|
9
|
+
package com.example.tamayamaryo.recipebook_sotuken
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
import android.content.Intent
|
16
|
+
|
17
|
+
import android.os.Bundle
|
18
|
+
|
19
|
+
import android.support.design.internal.BottomNavigationItemView
|
20
|
+
|
21
|
+
import android.support.v4.app.Fragment
|
22
|
+
|
23
|
+
import android.support.v4.app.FragmentActivity
|
24
|
+
|
25
|
+
import android.view.View
|
26
|
+
|
27
|
+
import android.widget.Button
|
28
|
+
|
29
|
+
import android.widget.ImageButton
|
30
|
+
|
31
|
+
import android.widget.ListView
|
32
|
+
|
33
|
+
import android.widget.TextView
|
34
|
+
|
35
|
+
import io.realm.Realm
|
36
|
+
|
37
|
+
import io.realm.RealmConfiguration
|
38
|
+
|
39
|
+
import io.realm.RealmResults
|
40
|
+
|
41
|
+
import io.realm.kotlin.where
|
42
|
+
|
43
|
+
import kotlinx.android.synthetic.main.activity_kakeibo.*
|
44
|
+
|
45
|
+
import kotlinx.android.synthetic.main.kakeibolist.*
|
46
|
+
|
47
|
+
import java.util.*
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
class kakeiboActivity : FragmentActivity(), DatePick.Callback {
|
54
|
+
|
55
|
+
private lateinit var realm: Realm
|
56
|
+
|
57
|
+
private fun initRealm() {
|
58
|
+
|
59
|
+
val realmConfiguration = RealmConfiguration.Builder()
|
60
|
+
|
61
|
+
.deleteRealmIfMigrationNeeded()
|
62
|
+
|
63
|
+
.schemaVersion(0)
|
64
|
+
|
65
|
+
.build()
|
66
|
+
|
67
|
+
realm = Realm.getInstance(realmConfiguration)
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
super.onCreate(savedInstanceState)
|
80
|
+
|
81
|
+
setContentView(R.layout.activity_kakeibo)
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
val config = RealmConfiguration.Builder().deleteRealmIfMigrationNeeded().build()
|
86
|
+
|
87
|
+
val test_navi = findViewById<Button>(R.id.insert_button)
|
88
|
+
|
89
|
+
val reload = findViewById<ImageButton>(R.id.reload_button)
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
Realm.setDefaultConfiguration(config)
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
realm = Realm.getDefaultInstance()
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
var listView: ListView
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
insert_button.setOnClickListener {
|
110
|
+
|
111
|
+
val intent = Intent(application, Kakeibo_AddActivity::class.java)
|
112
|
+
|
113
|
+
startActivity(intent)
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
val kakeibo_navi: BottomNavigationItemView = findViewById(R.id.navigation_kakeibo)
|
118
|
+
|
119
|
+
val resito_navi: BottomNavigationItemView = findViewById(R.id.navigation_resito)
|
120
|
+
|
121
|
+
val buylist_navi: BottomNavigationItemView = findViewById(R.id.navigation_buylist)
|
122
|
+
|
123
|
+
val recipe_navi: BottomNavigationItemView = findViewById(R.id.navigation_recipe)
|
124
|
+
|
125
|
+
kakeibo_navi.setOnClickListener {
|
126
|
+
|
127
|
+
val intent = Intent(this, kakeiboActivity::class.java)
|
128
|
+
|
129
|
+
startActivity(intent)
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
buylist_navi.setOnClickListener {
|
134
|
+
|
135
|
+
val intent = Intent(this, buylistActivity::class.java)
|
136
|
+
|
137
|
+
startActivity(intent)
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
resito_navi.setOnClickListener {
|
142
|
+
|
143
|
+
val intent = Intent(this, resitoActivity::class.java)
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
startActivity(intent)
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
recipe_navi.setOnClickListener {
|
152
|
+
|
153
|
+
val intent = Intent(this, MainActivity::class.java)
|
154
|
+
|
155
|
+
startActivity(intent)
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
listView = findViewById(R.id.kakeibolist)
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
val Kakeibo = realm.where<Kakeibo>().findAll()
|
166
|
+
|
167
|
+
listView?.adapter = KakeiboAdapter(Kakeibo)
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
override fun onDestroy() {
|
178
|
+
|
179
|
+
super.onDestroy()
|
180
|
+
|
181
|
+
realm.close()
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
override fun onDatePicked(year: Int,monthOfYear: Int, dayOfMonth: Int) {
|
186
|
+
|
187
|
+
val str = String.format(Locale.US, "%d/%d", year, monthOfYear+1 , dayOfMonth)
|
188
|
+
|
189
|
+
calendar.text = str
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
override fun onAttachFragment(fragment : Fragment) {
|
194
|
+
|
195
|
+
if(fragment is DatePick) {
|
196
|
+
|
197
|
+
fragment.callback = this
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
fun showDatePickerDialog(view: View) {
|
204
|
+
|
205
|
+
val newFragment = DatePick()
|
206
|
+
|
207
|
+
newFragment.show(supportFragmentManager, "datePicker")
|
208
|
+
|
209
|
+
}
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
```
|
216
|
+
|
7
217
|
```kotlin
|
8
218
|
|
9
|
-
package com.example.
|
219
|
+
package com.example.tamayamaryo.recipebook_sotuken
|
10
220
|
|
11
221
|
|
12
222
|
|
13
223
|
import android.app.DatePickerDialog
|
14
224
|
|
15
|
-
import android.
|
225
|
+
import android.app.Dialog
|
16
226
|
|
17
227
|
import android.os.Bundle
|
18
228
|
|
19
|
-
import android.support.design.internal.BottomNavigationItemView
|
20
|
-
|
21
229
|
import android.support.v4.app.DialogFragment
|
22
230
|
|
23
|
-
import android.support.v4.app.FragmentActivity
|
24
|
-
|
25
|
-
import android.util.Log
|
26
|
-
|
27
|
-
import android.view.View
|
28
|
-
|
29
|
-
import android.widget.Button
|
30
|
-
|
31
231
|
import android.widget.DatePicker
|
32
232
|
|
33
|
-
import android.widget.ListView
|
34
|
-
|
35
|
-
import io.realm.Realm
|
36
|
-
|
37
|
-
import io.realm.RealmConfiguration
|
38
|
-
|
39
|
-
import io.realm.kotlin.where
|
40
|
-
|
41
|
-
import kotlinx.android.synthetic.main.activity_kakeibo.*
|
42
|
-
|
43
|
-
import kotlinx.android.synthetic.main.testactivity.*
|
44
|
-
|
45
233
|
import java.util.*
|
46
234
|
|
47
235
|
|
48
236
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
val
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
}
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
o
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
val config = RealmConfiguration.Builder().deleteRealmIfMigrationNeeded().build()
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
Realm.setDefaultConfiguration(config)
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
realm = Realm.getDefaultInstance()
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
var listView: ListView
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
val test_navi= findViewById<Button>(R.id.insert_button)
|
104
|
-
|
105
|
-
insert_button.setOnClickListener {
|
106
|
-
|
107
|
-
val intent = Intent(application, Kakeibo_AddActivity::class.java)
|
108
|
-
|
109
|
-
startActivity(intent)
|
110
|
-
|
111
|
-
}
|
112
|
-
|
113
|
-
val kakeibo_navi: BottomNavigationItemView = findViewById(R.id.navigation_kakeibo)
|
114
|
-
|
115
|
-
val resito_navi: BottomNavigationItemView = findViewById(R.id.navigation_resito)
|
116
|
-
|
117
|
-
val buylist_navi: BottomNavigationItemView = findViewById(R.id.navigation_buylist)
|
118
|
-
|
119
|
-
val recipe_navi: BottomNavigationItemView = findViewById(R.id.navigation_recipe)
|
120
|
-
|
121
|
-
kakeibo_navi.setOnClickListener {
|
122
|
-
|
123
|
-
val intent = Intent(this, kakeiboActivity::class.java)
|
124
|
-
|
125
|
-
startActivity(intent)
|
126
|
-
|
127
|
-
}
|
128
|
-
|
129
|
-
buylist_navi.setOnClickListener {
|
130
|
-
|
131
|
-
val intent = Intent(this, buylistActivity::class.java)
|
132
|
-
|
133
|
-
startActivity(intent)
|
134
|
-
|
135
|
-
}
|
136
|
-
|
137
|
-
resito_navi.setOnClickListener {
|
138
|
-
|
139
|
-
val intent = Intent(this, resitoActivity::class.java)
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
startActivity(intent)
|
144
|
-
|
145
|
-
}
|
146
|
-
|
147
|
-
recipe_navi.setOnClickListener {
|
148
|
-
|
149
|
-
val intent = Intent(this, MainActivity::class.java)
|
150
|
-
|
151
|
-
startActivity(intent)
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
listView = findViewById(R.id.kakeibolist)
|
158
|
-
|
159
|
-
val Kakeibo = realm.where<Kakeibo>().findAll()
|
160
|
-
|
161
|
-
listView?.adapter = KakeiboAdapter(Kakeibo)
|
162
|
-
|
163
|
-
}
|
164
|
-
|
165
|
-
override fun onDestroy() {
|
166
|
-
|
167
|
-
super.onDestroy()
|
168
|
-
|
169
|
-
realm.close()
|
170
|
-
|
171
|
-
}
|
172
|
-
|
173
|
-
override fun onDateSet(view: DatePicker, year: Int, monthOfYear: Int, dayOfMonth: Int) {
|
174
|
-
|
175
|
-
val str = String.format(Locale.US, "%d/%d", year, monthOfYear+1, dayOfMonth)
|
176
|
-
|
177
|
-
calendar.text = str
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
}
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
fun showDatePickerDialog1(view: View) {
|
186
|
-
|
187
|
-
val newFragment = DatePickk()
|
188
|
-
|
189
|
-
newFragment.show(supportFragmentManager, "datePicker")
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
}
|
194
|
-
|
195
|
-
|
237
|
+
class DatePick : DialogFragment(),DatePickerDialog.OnDateSetListener {
|
238
|
+
|
239
|
+
var callback : Callback? = null
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
244
|
+
|
245
|
+
val c = Calendar.getInstance()
|
246
|
+
|
247
|
+
val year = c.get(Calendar.YEAR)
|
248
|
+
|
249
|
+
val month = c.get(Calendar.MONTH)
|
250
|
+
|
251
|
+
val day = c.get(Calendar.DAY_OF_MONTH)
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
return DatePickerDialog(activity,this, year,month,day)
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
override fun onDateSet(view: DatePicker, year: Int,month: Int, dayOfMonth: Int) {
|
260
|
+
|
261
|
+
callback?.onDatePicked(year , month , dayOfMonth)
|
262
|
+
|
263
|
+
}
|
264
|
+
|
265
|
+
interface Callback {
|
266
|
+
|
267
|
+
fun onDatePicked(year : Int , monthOfYear: Int , dayOfMonth: Int)
|
268
|
+
|
269
|
+
}
|
196
270
|
|
197
271
|
}
|
198
272
|
|
199
273
|
```
|
200
274
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
r
|
234
|
-
|
235
|
-
a
|
236
|
-
|
237
|
-
a
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
```xml
|
280
|
+
|
281
|
+
<?xml version="1.0" encoding="utf-8"?>
|
282
|
+
|
283
|
+
<android.support.constraint.ConstraintLayout
|
284
|
+
|
285
|
+
xmlns:android="http://schemas.android.com/apk/res/android"
|
286
|
+
|
287
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
288
|
+
|
289
|
+
xmlns:tools="http://schemas.android.com/tools"
|
290
|
+
|
291
|
+
android:id="@+id/container"
|
292
|
+
|
293
|
+
android:layout_width="match_parent"
|
294
|
+
|
295
|
+
android:layout_height="match_parent"
|
296
|
+
|
297
|
+
tools:context=".MainActivity">
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
<TextView
|
302
|
+
|
303
|
+
android:id="@+id/calendar"
|
304
|
+
|
305
|
+
android:layout_width="wrap_content"
|
306
|
+
|
307
|
+
android:layout_height="wrap_content"
|
308
|
+
|
309
|
+
android:layout_marginLeft="16dp"
|
310
|
+
|
311
|
+
android:text="@string/title_nengetu"
|
312
|
+
|
313
|
+
android:textSize="25dp"
|
314
|
+
|
315
|
+
android:onClick="showDatePickerDialog1"
|
316
|
+
|
317
|
+
app:layout_constraintLeft_toLeftOf="parent"
|
318
|
+
|
319
|
+
app:layout_constraintTop_toTopOf="parent"
|
320
|
+
|
321
|
+
android:layout_marginTop="12dp"
|
322
|
+
|
323
|
+
/>
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
<View
|
328
|
+
|
329
|
+
android:layout_width="match_parent"
|
330
|
+
|
331
|
+
android:layout_height="2.5dp"
|
332
|
+
|
333
|
+
android:background="@color/blackColor"
|
334
|
+
|
335
|
+
android:layout_marginLeft="10dp"
|
336
|
+
|
337
|
+
android:layout_marginRight="10dp"
|
338
|
+
|
339
|
+
app:layout_constraintRight_toRightOf="parent"
|
340
|
+
|
341
|
+
app:layout_constraintLeft_toLeftOf="parent"
|
342
|
+
|
343
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
344
|
+
|
345
|
+
app:layout_constraintTop_toTopOf="parent"
|
346
|
+
|
347
|
+
app:layout_constraintHorizontal_bias="1.0"
|
348
|
+
|
349
|
+
app:layout_constraintVertical_bias="0.092"/>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
<android.support.design.widget.BottomNavigationView
|
354
|
+
|
355
|
+
android:id="@+id/navigation"
|
356
|
+
|
357
|
+
android:layout_width="0dp"
|
358
|
+
|
359
|
+
android:layout_height="wrap_content"
|
360
|
+
|
361
|
+
android:layout_marginEnd="0dp"
|
362
|
+
|
363
|
+
android:layout_marginStart="0dp"
|
364
|
+
|
365
|
+
android:background="?android:attr/windowBackground"
|
366
|
+
|
367
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
368
|
+
|
369
|
+
app:layout_constraintLeft_toLeftOf="parent"
|
370
|
+
|
371
|
+
app:layout_constraintRight_toRightOf="parent"
|
372
|
+
|
373
|
+
app:menu="@menu/navigation"/>
|
374
|
+
|
375
|
+
<ListView
|
376
|
+
|
377
|
+
android:id="@+id/kakeibolist"
|
378
|
+
|
379
|
+
android:layout_width="382dp"
|
380
|
+
|
381
|
+
android:layout_height="405dp"
|
382
|
+
|
383
|
+
app:layout_constraintLeft_toLeftOf="parent"
|
384
|
+
|
385
|
+
app:layout_constraintRight_toRightOf="parent"
|
386
|
+
|
387
|
+
app:layout_constraintTop_toTopOf="parent"
|
388
|
+
|
389
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
390
|
+
|
391
|
+
app:layout_constraintHorizontal_bias="0.0"
|
392
|
+
|
393
|
+
app:layout_constraintVertical_bias="0.433"/>
|
394
|
+
|
395
|
+
<Button
|
396
|
+
|
397
|
+
android:id="@+id/insert_button"
|
398
|
+
|
399
|
+
android:layout_width="wrap_content"
|
400
|
+
|
401
|
+
android:layout_height="wrap_content"
|
402
|
+
|
403
|
+
android:text="@string/insert_gamen"
|
404
|
+
|
405
|
+
android:layout_marginBottom="300dp"
|
406
|
+
|
407
|
+
android:layout_marginLeft="260dp"
|
408
|
+
|
409
|
+
app:layout_constraintLeft_toLeftOf="parent"
|
410
|
+
|
411
|
+
app:layout_constraintRight_toRightOf="parent"
|
412
|
+
|
413
|
+
app:layout_constraintTop_toTopOf="parent"
|
414
|
+
|
415
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
416
|
+
|
417
|
+
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintVertical_bias="0.0"/>
|
418
|
+
|
419
|
+
</android.support.constraint.ConstraintLayout>
|
254
420
|
|
255
421
|
```
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
```xml
|
260
|
-
|
261
|
-
<?xml version="1.0" encoding="utf-8"?>
|
262
|
-
|
263
|
-
<android.support.constraint.ConstraintLayout
|
264
|
-
|
265
|
-
xmlns:android="http://schemas.android.com/apk/res/android"
|
266
|
-
|
267
|
-
xmlns:app="http://schemas.android.com/apk/res-auto"
|
268
|
-
|
269
|
-
xmlns:tools="http://schemas.android.com/tools"
|
270
|
-
|
271
|
-
android:id="@+id/container"
|
272
|
-
|
273
|
-
android:layout_width="match_parent"
|
274
|
-
|
275
|
-
android:layout_height="match_parent"
|
276
|
-
|
277
|
-
tools:context=".MainActivity">
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
<TextView
|
282
|
-
|
283
|
-
android:id="@+id/calendar"
|
284
|
-
|
285
|
-
android:layout_width="wrap_content"
|
286
|
-
|
287
|
-
android:layout_height="wrap_content"
|
288
|
-
|
289
|
-
android:layout_marginLeft="16dp"
|
290
|
-
|
291
|
-
android:text="@string/title_nengetu"
|
292
|
-
|
293
|
-
android:textSize="25dp"
|
294
|
-
|
295
|
-
android:onClick="showDatePickerDialog1"
|
296
|
-
|
297
|
-
app:layout_constraintLeft_toLeftOf="parent"
|
298
|
-
|
299
|
-
app:layout_constraintTop_toTopOf="parent"
|
300
|
-
|
301
|
-
android:layout_marginTop="12dp"
|
302
|
-
|
303
|
-
/>
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
<View
|
308
|
-
|
309
|
-
android:layout_width="match_parent"
|
310
|
-
|
311
|
-
android:layout_height="2.5dp"
|
312
|
-
|
313
|
-
android:background="@color/blackColor"
|
314
|
-
|
315
|
-
android:layout_marginLeft="10dp"
|
316
|
-
|
317
|
-
android:layout_marginRight="10dp"
|
318
|
-
|
319
|
-
app:layout_constraintRight_toRightOf="parent"
|
320
|
-
|
321
|
-
app:layout_constraintLeft_toLeftOf="parent"
|
322
|
-
|
323
|
-
app:layout_constraintBottom_toBottomOf="parent"
|
324
|
-
|
325
|
-
app:layout_constraintTop_toTopOf="parent"
|
326
|
-
|
327
|
-
app:layout_constraintHorizontal_bias="1.0"
|
328
|
-
|
329
|
-
app:layout_constraintVertical_bias="0.092"/>
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
<android.support.design.widget.BottomNavigationView
|
334
|
-
|
335
|
-
android:id="@+id/navigation"
|
336
|
-
|
337
|
-
android:layout_width="0dp"
|
338
|
-
|
339
|
-
android:layout_height="wrap_content"
|
340
|
-
|
341
|
-
android:layout_marginEnd="0dp"
|
342
|
-
|
343
|
-
android:layout_marginStart="0dp"
|
344
|
-
|
345
|
-
android:background="?android:attr/windowBackground"
|
346
|
-
|
347
|
-
app:layout_constraintBottom_toBottomOf="parent"
|
348
|
-
|
349
|
-
app:layout_constraintLeft_toLeftOf="parent"
|
350
|
-
|
351
|
-
app:layout_constraintRight_toRightOf="parent"
|
352
|
-
|
353
|
-
app:menu="@menu/navigation"/>
|
354
|
-
|
355
|
-
<ListView
|
356
|
-
|
357
|
-
android:id="@+id/kakeibolist"
|
358
|
-
|
359
|
-
android:layout_width="382dp"
|
360
|
-
|
361
|
-
android:layout_height="405dp"
|
362
|
-
|
363
|
-
app:layout_constraintLeft_toLeftOf="parent"
|
364
|
-
|
365
|
-
app:layout_constraintRight_toRightOf="parent"
|
366
|
-
|
367
|
-
app:layout_constraintTop_toTopOf="parent"
|
368
|
-
|
369
|
-
app:layout_constraintBottom_toBottomOf="parent"
|
370
|
-
|
371
|
-
app:layout_constraintHorizontal_bias="0.0"
|
372
|
-
|
373
|
-
app:layout_constraintVertical_bias="0.433"/>
|
374
|
-
|
375
|
-
<Button
|
376
|
-
|
377
|
-
android:id="@+id/insert_button"
|
378
|
-
|
379
|
-
android:layout_width="wrap_content"
|
380
|
-
|
381
|
-
android:layout_height="wrap_content"
|
382
|
-
|
383
|
-
android:text="@string/insert_gamen"
|
384
|
-
|
385
|
-
android:layout_marginBottom="300dp"
|
386
|
-
|
387
|
-
android:layout_marginLeft="260dp"
|
388
|
-
|
389
|
-
app:layout_constraintLeft_toLeftOf="parent"
|
390
|
-
|
391
|
-
app:layout_constraintRight_toRightOf="parent"
|
392
|
-
|
393
|
-
app:layout_constraintTop_toTopOf="parent"
|
394
|
-
|
395
|
-
app:layout_constraintBottom_toBottomOf="parent"
|
396
|
-
|
397
|
-
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintVertical_bias="0.0"/>
|
398
|
-
|
399
|
-
</android.support.constraint.ConstraintLayout>
|
400
|
-
|
401
|
-
```
|
2
追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
家計簿アプリを作成しています。家計簿アプリでは月ごとの収支を一覧表示させたいと考えています。
|
2
|
-
|
3
|
-
例えばDatePickerDialogで選択された2018/12の収支データだけ取ってくるような機能で考えています。DatePickerDialogを使って検索値になる2018/12のデータは取ってこれるのですが、DatePickerDialogのPositiveButtonの処理を書く場所と書き方がよくわからず困っています。
|
1
|
+
家計簿アプリを作成しています。家計簿アプリでは月ごとの収支を一覧表示させたいと考えています。家計簿の収支データはもちろん2018年の11月のデータもあれば2018年の12月のデータも格納されていると仮定します。DatePickerDialogで年月を選択し(2018/12と選択したとします)、OKと押したときに2018/12に該当するデータのみ一覧表示させたいと考えています。DatePickerDialogを使って検索値となる2018/12のデータは取ってこれるのですが、DatePickerDialogの処理を書く場所と書き方がよくわからず困っています。![イメージ説明](ca8b4a7bbadd4afce6cb6b16c19de4c2.png)
|
4
2
|
|
5
3
|
どなたかご教授お願いします。
|
6
4
|
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
家計簿アプリを作成しています。家計簿アプリでは月ごとの収支を一覧表示させたいと考えています。
|
2
2
|
|
3
|
-
例えばDatePickerDialogで選択された2018/12の収支データだけ取ってくるような機能で考えています。DatePickerDialogを使って検索値になる2018/12のデータは取ってこれるのですが、DatePickerDialogのPositiveButtonの処理を書
|
3
|
+
例えばDatePickerDialogで選択された2018/12の収支データだけ取ってくるような機能で考えています。DatePickerDialogを使って検索値になる2018/12のデータは取ってこれるのですが、DatePickerDialogのPositiveButtonの処理を書く場所と書き方がよくわからず困っています。
|
4
4
|
|
5
5
|
どなたかご教授お願いします。
|
6
6
|
|