2012-01-08 59 views
2

我想为给定的电话号码显示收件箱并发送消息。我的适配器是这样的:如何在CursorAdapter中使用2个游标?

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; 
    } 

} 

我希望它按日期排序,就像在默认消息应用程序中的对话。我该怎么做?有可能,或者我应该使用一个ArrayAdapter?

回答