From b3f77945e83340874b31d7f0a64038a916550d5b Mon Sep 17 00:00:00 2001 From: Isaac Devine Date: Sat, 4 May 2013 16:09:16 +1200 Subject: [PATCH] Make example work on devices less than honeycomb Change the call to swapCursor to use a pre-honeycomb (almost) equivalent when running on a device on a lower sdk. The changeCursor call will close the cursor, where the swapCursor call doesn't, but this doesn't affect the logic here. --- .../content/example/SimpleContentProviderExample.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/example/src/edu/mit/mobile/android/content/example/SimpleContentProviderExample.java b/example/src/edu/mit/mobile/android/content/example/SimpleContentProviderExample.java index ed12696..a61a45f 100644 --- a/example/src/edu/mit/mobile/android/content/example/SimpleContentProviderExample.java +++ b/example/src/edu/mit/mobile/android/content/example/SimpleContentProviderExample.java @@ -154,7 +154,11 @@ private void loadContent(Uri data) { // none of the cursors need to be closed, as managedQuery will take care of this. Note: // in later versions of Android, one should use a CursorLoader instead. final Cursor c = managedQuery(data, PROJECTION, null, null, SORT_ORDER); - mListAdapter.swapCursor(c); + if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { + mListAdapter.changeCursor(c); + } else { + mListAdapter.swapCursor(c); + } // this exception is triggered when there's an invalid filter. } catch (final IllegalArgumentException e) {