我在适配器中加载数据库值并在listview中显示但问题是listview显示完整格式如22/11/2013 11:19我只显示小时和分钟所以我如何格式化我的这个行holder.msgtext3.setText (“”+ msglist.get(position).getTime());在textvew中只显示小时和分钟?任何的想法?
public class MessageAdapter extends ArrayAdapter<MessageModel> {
Activity context;
List<MessageModel> msglist;
ViewHolder holder;
public MessageAdapter(Activity context, List<MessageModel> dealList) {
super(context, R.layout.msgrow, dealList);
// TODO Auto-generated constructor stub
this.context = context;
this.msglist = dealList;
}
class ViewHolder {
protected TextView msgtext, timemsg ,msgtext2 ,msgtext3;
}
public View getView(int position, View convertView, ViewGroup arg2) {
// TODO Auto-generated method stub
View view = null;
if (convertView == null) {
LayoutInflater inflator = context.getLayoutInflater();
view = inflator.inflate(R.layout.msgrow, null);
final ViewHolder viewHolder = new ViewHolder();
viewHolder.msgtext = (TextView) view.findViewById(R.id.msgDatatextview);
viewHolder.msgtext3 = (TextView) view.findViewById(R.id.msgDatatextview3);
view.setTag(viewHolder);
} else {
view = convertView;
}
msglist.get(position).getTime();
holder = (ViewHolder) view.getTag();
holder.msgtext.setText("" + msglist.get(position).getMsg());
holder.msgtext3.setText("" + msglist.get(position).getTime());
return view;
}
}