diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index af5d946eb..95267e01f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -239,12 +239,14 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer // sample only has one Loader, so we don't care about the ID. Uri baseUri = KeyRings.buildPublicKeyRingsUri(); String where = null; - if(mCurQuery != null) - where = KeychainContract.UserIds.USER_ID + " LIKE \"" + mCurQuery + "%\""; - + String whereArgs[] = null; + if(mCurQuery != null){ + where = KeychainContract.UserIds.USER_ID + " LIKE ?"; + whereArgs = new String[]{mCurQuery+"%"}; + } // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. - return new CursorLoader(getActivity(), baseUri, PROJECTION, where, null, SORT_ORDER); + return new CursorLoader(getActivity(), baseUri, PROJECTION, where, whereArgs, SORT_ORDER); } @Override diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java index e3e5c55fb..a43c84cf4 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java @@ -226,13 +226,15 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T orderBy = inMasterKeyList + " DESC, " + orderBy; } String where = null; - if(mCurQuery != null) - where = UserIds.USER_ID + " LIKE \"" + mCurQuery + "%\""; - + String whereArgs[] = null; + if(mCurQuery != null){ + where = UserIds.USER_ID + " LIKE ?"; + whereArgs = new String[]{mCurQuery+"%"}; + } // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. - return new CursorLoader(getActivity(), baseUri, projection, where, null, orderBy); + return new CursorLoader(getActivity(), baseUri, projection, where, whereArgs, orderBy); } @Override