마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

리스트뷰 역순 출력 도와주세요 ㅠ

0 추천
public void RefreshList() {
  cursor1 = QueryData();
  
  if (cursor1 != null) {
   startManagingCursor(cursor1);
   String[] columns = {"day", "memo"};
   int[] reIds = {R.id.textView2, R.id.textView1};
   adapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.listitem, cursor1, columns, reIds); 
   list01.setAdapter(adapter);
   text01.setText("");
   text01.append("Index : " + count);
  }
}

private Cursor QueryData() {
     String sql = "select _id, num, day, memo from " + TableName;
     
     cursor1 = database.rawQuery(sql, null);
     
     if(cursor1 != null) {
      count = cursor1.getCount();
      for(int i = 0; i < count; i++) {
       cursor1.moveToNext();
       Notimemo = cursor1.getString(2);
      }
}
  return cursor1;
}

/*이걸 넣으라고 하는데... 넣어도 되질 않습니다. ㅠㅠ
Collections.reverse(list01);
*/

리스트뷰를 역순으로 출력하고 싶습니다.

아직 실력이 부족해서.. 도와주세요 ㅠㅠ

Android초보개발자 (1,230 포인트) 님이 2014년 8월 27일 질문

1개의 답변

+1 추천
 
채택된 답변
Select 할때 order by 로 역순정렬하세요....;;
익명사용자 님이 2014년 8월 27일 답변
Android초보개발자님이 2014년 10월 5일 채택됨
답변 감사합니다.
그런데 정확히 어떻게 써야될지...
"select _id, num, day, memo from " + TableName + " order by _id";
로 했는데 되질 않네요 ㅠㅠ
해결했습니다!! 감사합니다.
"select _id, num, day, memo from " + TableName + " order by _id desc";
이렇게 하면 되더군요 ㅎㅎ
...