2010년 12월 30일 목요일

[Android Course][English][Theme] - DB Query () API uses the wrong





: ContentProvider between the Application is the only way to share data. ContentProvider to store and retrieve the data and allows access from any Application. Usually at this time to have access to Database "Cursor & Query ()" API is used.

=> Here I am 'Query ()' instead, 'managedQuery ()' is recommended for use.
Operating the same, but
managedQuery () write the life cycle of the activity has the advantage that it behaves like.
In other words, cursor.close onDestroy do not call the call automatically when the cursor is a Close.

- "Cursor & Query()" Wrong usage example
Cursor cursor = ContentResolver.query(....................................);
=> After straightening using 'cursor.close ();' If I tell you, leak or dead can happen.

- "Cursor & Query()" Recommended Usage Examples
Cursor cursor = managedQuery(....................................);


In addition, inquiries, or questions, please contact us.
(joonryang@gmail.com)

댓글 없음:

댓글 쓰기