public synchronized int getPosition(Story story) { int pos = 0; while (pos < stories.getCount()) { stories.moveToPosition(pos); if (Story.fromCursor(stories).equals(story)) { return pos; } pos++; } return -1; }
public synchronized Story getStory(int position) { if (stories == null || stories.getColumnCount() == 0 || position >= stories.getCount() || position < 0) { return null; } else { stories.moveToPosition(position); return Story.fromCursor(stories); } }