Reputation: 521
I have the one requirement to add the special item in the listview, which fully differnt with the others, and this is add dynamicly(when the user enter the special text) . and the listview used the SimpleCursorAdapter to show the custom item. and this adapter: public class TweetAdapter extends SimpleCursorAdapter implements FilterQueryProvider
has no addItem() function, and the getView() just call super() function. so I hava no idea about it. could you help me about this. Thanks.
Upvotes: 0
Views: 1207
Reputation: 14038
CursorAdapter is not modifiable as such, so you wont be able to add custom elements at runtime and change the listView. You will need to use a MatrixCursor which is a modifiable form of Adapter. http://developer.android.com/reference/android/database/MatrixCursor.html First, Make a matrix cursor from your existing cursoradapter, and use this matrixcursor as the data source. It is a mutable cursor, so you add rows whenever you want.
Upvotes: 1