|
|
137
|
+ * position in the data set.
|
|
|
138
|
+ * @param position Position of the item whose data we want
|
|
|
139
|
+ * @param convertView View to recycle, if not null
|
|
|
140
|
+ * @param parent ViewGroup containing the returned View
|
|
|
141
|
+ */
|
|
|
142
|
+ @Override
|
|
|
143
|
+ public View getView(int position, View convertView,
|
|
|
144
|
+ ViewGroup parent) {
|
|
|
145
|
+ View result=views.get(position);
|
|
|
146
|
+
|
|
|
147
|
+ if (result==null) {
|
|
|
148
|
+ result=newView(position, parent);
|
|
|
149
|
+ views.set(position, result);
|
|
|
150
|
+ }
|
|
|
151
|
+
|
|
|
152
|
+ return(result);
|
|
|
153
|
+ }
|
|
|
154
|
+
|
|
|
155
|
+ /**
|
|
|
156
|
+ * Get the row id associated with the specified position
|
|
|
157
|
+ * in the list.
|
|
|
158
|
+ * @param position Position of the item whose data we want
|
|
|
159
|
+ */
|
|
|
160
|
+ @Override
|
|
|
161
|
+ public long getItemId(int position) {
|
|
|
162
|
+ return(position);
|
|
|
163
|
+ }
|
|
|
164
|
+
|
|
|
165
|
+ public boolean hasView(View v) {
|
|
|
166
|
+ return(views.contains(v));
|
|
|
167
|
+ }
|
|
|
168
|
+
|
|
|
169
|
+ /**
|
|
|
170
|
+ * Create a new View to go into the list at the specified
|
|
|
171
|
+ * position.
|
|
|
172
|
+ * @param position Position of the item whose data we want
|
|
|
173
|
+ * @param parent ViewGroup containing the returned View
|
|
|
174
|
+ */
|
|
|
175
|
+ protected View newView(int position, ViewGroup parent) {
|
|
|
176
|
+ throw new RuntimeException("You must override newView()!");
|
|
|
177
|
+ }
|
|
|
178
|
+}
|