안녕하세요.


listView 와 cursorAdapter를 이용해서 리스트 뷰에 디비 정보를 뿌려주고 있는데요.


로그를 찍으면 정확하게 잘 나오는데, 이상하게 화면에선 리스트 순서가 뒤죽박죽으로 나오네요.


문제점이 뭔지 알려주시면 감사하겠습니다.


ps. 제가 모르고 14를 두번 입력했습니다.



스크린샷 2012-02-21 오전 10.59.30.png                 스크린샷 2012-02-21 오전 11.00.30.png


myAdapter = new ChattingListAdapter ( getApplicationContext (), cursor );

chatList.setAdapter ( myAdapter );

chatList.setDivider ( null );



--------------------------------------------------------------------------------------------------


코드 뷰어가 깨져서 일단 이렇게 올려봅니당...



public
 View newView ( Context context, Cursor cursor, ViewGroup parent ) {

LayoutInflater inflater = LayoutInflater.from ( context );


who = cursor.getString ( cursor.getColumnIndex ( Constants.TABLE_CONVERSATION_FIELD_FROM ) );

if ( who.equals ( "me" ) ) {

view = inflater.inflate ( R.layout.i_talk_layout, parent, false );

textSay = (TextView) view.findViewById ( R.id.i_says );

textDate = (TextView) view.findViewById ( R.id.i_date );

else {

view = inflater.inflate ( R.layout.friend_talk_layout, parent, false );

textSay = (TextView) view.findViewById ( R.id.friend_says );

textDate = (TextView) view.findViewById ( R.id.friend_date );

}

return view;

}


@ Override


public void bindView ( View view, Context context, Cursor cursor ) {


Date temp = new Date ( cursor.getLong ( cursor.getColumnIndex ( Constants.TABLE_CONVERSATION_FIELD_DATE ) ) );

String date;


date = df.format ( temp.getTime () );


Log.v ( MY_TAG"textSay :" + cursor.getString ( cursor.getColumnIndex ( Constants.TABLE_CONVERSATION_FIELD_MSG ) )  + ", textDate :" + date);


textSay.setText ( cursor.getString ( cursor.getColumnIndex ( Constants.TABLE_CONVERSATION_FIELD_MSG ) ) );

textDate.setText ( date );

}


 

public View newView ( Context context, Cursor cursor, ViewGroup parent ) {
LayoutInflater inflater = LayoutInflater.from ( context );
who = cursor.getString ( cursor.getColumnIndex ( Constants.TABLE_CONVERSATION_FIELD_FROM ) );
if ( who.equals ( "me" ) ) {
view = inflater.inflate ( R.layout.i_talk_layout, parent, false );
textSay = (TextView) view.findViewById ( R.id.i_says );
textDate = (TextView) view.findViewById ( R.id.i_date );
} else {
view = inflater.inflate ( R.layout.friend_talk_layout, parent, false );
textSay = (TextView) view.findViewById ( R.id.friend_says );
textDate = (TextView) view.findViewById ( R.id.friend_date );
}
return view;}
@ Override
public void bindView ( View view, Context context, Cursor cursor ) {
Date temp = new Date ( cursor.getLong ( cursor.getColumnIndex ( Constants.TABLE_CONVERSATION_FIELD_DATE ) ) );
String date;
date = df.format ( temp.getTime () );
Log.v ( MY_TAG, "textSay :" + cursor.getString ( cursor.getColumnIndex ( Constants.TABLE_CONVERSATION_FIELD_MSG ) )  + ", textDate :" + date);
textSay.setText ( cursor.getString ( cursor.getColumnIndex ( Constants.TABLE_CONVERSATION_FIELD_MSG ) ) );
textDate.setText ( date );}