Use query conditions for the name lookup :D

This commit is contained in:
Brion Vibber 2013-04-24 08:01:17 -07:00
parent 29ebce5ab0
commit 308b28dd23

View file

@ -238,16 +238,13 @@ public class CategorizationFragment extends SherlockFragment{
Cursor cursor = getActivity().getContentResolver().query( Cursor cursor = getActivity().getContentResolver().query(
CategoryContentProvider.BASE_URI, CategoryContentProvider.BASE_URI,
Category.Table.ALL_FIELDS, Category.Table.ALL_FIELDS,
null, Category.Table.COLUMN_NAME + "=?",
new String[] {}, new String[] {name},
null); null);
// fixme move to conditions if (cursor.moveToNext()) {
while (cursor.moveToNext()) {
Category cat = Category.fromCursor(cursor); Category cat = Category.fromCursor(cursor);
if (cat.getName().equals(name)) {
return cat; return cat;
} }
}
// Newly used category... // Newly used category...
Category cat = new Category(); Category cat = new Category();