I want to display inbox and sent messages for a given phone number. My adapter is like this :
public class MessageListAdapter extends CursorAdapter {
LayoutInflater inflater;
public MessageListAdapter(Context context, Cursor inbox) {
super(context, inbox);
inflater = LayoutInflater.from(context);
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
TextView messagetext= (TextView) view.findViewById(R.id.message);
messagetext.setText(inbox.getString(0));
TextView date= (TextView) view.findViewById(R.id.message);
date.setText(inbox.getString(1));
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup group) {
View view = inflater.inflate(R.layout.inboxlistitems, null);
return view;
}
}
I want it to be sorted by date, like a conversation in default messaging app. How can I do it? is it possible, or should I use instead an ArrayAdapter?