public void bindView(View view, Context context, Cursor cursor) {
int num=cursor.getLong(0);
//cursor.close();
}
is closing cursors in adapter bindview correct ? and in what conditions should I do that ? or maybe I should never do it . . .
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No it is not. The CursorAdapter needs the Cursor to display further rows if the user scrolls. What you need to do is create the Cursor in onCreate and close it in onDestroy.
Or just create a Cursor and let the Activity manage it:
If you use startManagingCursor() your Activity will close the Cursor when it gets destroyed.