I have a listview that gets it's posts from a database. I want the ten latest entries sorted by the time they where added to the database. This works, but it always skips the first post until a newer one is added. What could I be doing wrong?
For this I use the following code: public Cursor fetchAll() { Cursor mCursor = mDb.query(_TABLE, new String[] {_ROWID, _NAME, _TEXT, _TIME}, null, null, null, null, _TIME + " DESC", " 10"); return mCursor; } Cursor cursor = db.fetchAll(); startManagingCursor(cursor); ArrayList strings = new ArrayList(); for(cursor.moveToFirst(); cursor.moveToNext(); cursor.isAfterLast()) { String name = cursor.getString(cursor.getColumnIndex(db._NAME)); strings.add(name); } String[] mNames = (String[]) strings.toArray(new String[strings.size()]); ArrayList strings1 = new ArrayList(); for(cursor.moveToFirst(); cursor.moveToNext();cursor.isAfterLast()) { String name = cursor.getString(cursor.getColumnIndex(db._TEXT)); strings1.add(name); } String[] mPath = (String[]) strings1.toArray(new String[strings1.size()]); // André -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en