I've begun using fragments with the compatibility library in my
Android apps. Personally it has been a rather frustrating but rewarding
experience.
The rewarding bit was the substantial gain in responsiveness when moving from a "managedQuery" approach to the "LoaderManager" approach in querying for a cursor. LoaderManager and Cursor Loaders as one knows basically queries for the cursor in a background thread.
Coming to the frustrating bit, I wasn't aware (my fault entirely for not reading the documentation thoroughly) that once you use the LoaderManager/CursorLoader it is necessary to use the CursorAdapter included in the compatibility library. Therefore for about 2 days I never really say much of a gain in responsiveness and I actually managed to make the app a lot more unstable, until I figured out that it was a requirement to use the CursorAdapter from the compatibility library. Note to self: Make sure you read the documentation thoroughly. In this case USE THE COMPATIBILITY LIBRARY CURSOR ADAPTER in particular the cursoradapter must be instantiated using this constructor "CursorAdapter(Context context, Cursor c, int flags)" in order to make full use of the
potential of the background querying for the cursor. More info: http://developer.android.com/reference/android/widget/CursorAdapter.html
The rewarding bit was the substantial gain in responsiveness when moving from a "managedQuery" approach to the "LoaderManager" approach in querying for a cursor. LoaderManager and Cursor Loaders as one knows basically queries for the cursor in a background thread.
Coming to the frustrating bit, I wasn't aware (my fault entirely for not reading the documentation thoroughly) that once you use the LoaderManager/CursorLoader it is necessary to use the CursorAdapter included in the compatibility library. Therefore for about 2 days I never really say much of a gain in responsiveness and I actually managed to make the app a lot more unstable, until I figured out that it was a requirement to use the CursorAdapter from the compatibility library. Note to self: Make sure you read the documentation thoroughly. In this case USE THE COMPATIBILITY LIBRARY CURSOR ADAPTER in particular the cursoradapter must be instantiated using this constructor "CursorAdapter(Context context, Cursor c, int flags)" in order to make full use of the
potential of the background querying for the cursor. More info: http://developer.android.com/reference/android/widget/CursorAdapter.html
No comments:
Post a Comment