質問編集履歴

6

誤字

2017/06/02 08:39

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -58,7 +58,7 @@
58
58
 
59
59
  ```
60
60
 
61
- adapter
61
+ adapter
62
62
 
63
63
 
64
64
 

5

誤字

2017/06/02 08:39

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -122,8 +122,6 @@
122
122
 
123
123
  choiceList.remove(item)
124
124
 
125
- choiceList.add(item)
126
-
127
125
  } else {
128
126
 
129
127
  choiceList.add(item)

4

誤字

2017/06/02 08:34

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -116,6 +116,8 @@
116
116
 
117
117
  fun choice(position: Int) {
118
118
 
119
+ val item = getItem(position)
120
+
119
121
  if (choiceList.contains(item)) {
120
122
 
121
123
  choiceList.remove(item)

3

修正

2017/06/02 08:33

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -72,7 +72,7 @@
72
72
 
73
73
 
74
74
 
75
- init {
75
+ init {
76
76
 
77
77
  this.choiceList = HashSet<Cursor>()
78
78
 

2

修正

2017/06/02 08:33

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -66,6 +66,20 @@
66
66
 
67
67
  class ImageCursorAdapter(val context: Context?, c: Cursor?, flags: Int) : CursorAdapter(context, c, flags) {
68
68
 
69
+
70
+
71
+ private val choiceList: HashSet<Cursor>
72
+
73
+
74
+
75
+ init {
76
+
77
+ this.choiceList = HashSet<Cursor>()
78
+
79
+ }
80
+
81
+
82
+
69
83
  override fun newView(context: Context?, cursor: Cursor?, parent: ViewGroup?): View? {
70
84
 
71
85
  //省略
@@ -98,6 +112,28 @@
98
112
 
99
113
 
100
114
 
115
+
116
+
117
+ fun choice(position: Int) {
118
+
119
+ if (choiceList.contains(item)) {
120
+
121
+ choiceList.remove(item)
122
+
123
+ choiceList.add(item)
124
+
125
+ } else {
126
+
127
+ choiceList.add(item)
128
+
129
+ }
130
+
131
+ notifyDataSetChanged()
132
+
133
+ }
134
+
135
+
136
+
101
137
  }
102
138
 
103
139
 

1

誤字

2017/06/02 08:32

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -48,7 +48,7 @@
48
48
 
49
49
  override fun onLoaderReset(loader: Loader<Cursor>?) {
50
50
 
51
- imageCursorAdapter!!.swapCursor(null)
51
+
52
52
 
53
53
  }
54
54
 
@@ -116,4 +116,4 @@
116
116
 
117
117
 
118
118
 
119
- 任意のpositionのcursorのデータを取得したい場合どのようにすればよいか教えてください。
119
+ 任意のpositionのcursorのデータ(レコード?)を取得したい場合どのようにすればよいか教えてください。