How can I create a list Array (the list display First Alphabet when scroll) with the cursor data?
Even better than @imbrizi's answer is this:
ArrayList mArrayList = new ArrayList();
while(mCursor.moveToNext()) {
mArrayList.add(mCursor.getString(mCursor.getColumnIndex(dbAdapter.KEY_NAME))); //add the item
}
moveToNext() will return false if there isn't anything left, so this reduces the SLOC by a few, and is easier to see.
Even better is to get the column index outside of the loop.
ArrayList mArrayList = new ArrayList();
int columnIndex=mCursor.getColumnIndex(dbAdapter.KEY_NAME)
while(mCursor.moveToNext()) {
mArrayList.add(mCursor.getString(columnIndex)); //add the item
}