已经按日期排序itemBean名单? [英] Sorting list having itemBean by date?

查看:145
本文介绍了已经按日期排序itemBean名单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何按日期排序的Andr​​oid清单

how to sort a list by date in android

List<ItemBean> listIB = new ArrayList<ItemBean>();
for(int i=0; i<DispLibActivity.itemListVect.size(); i++)
{
    listIB.add(DispLibActivity.itemListVect.get(i));
}

ItemBean类有一个成员日期

ItemBean class have a member date

public class ItemBean implements Parcelable{
    String item_id, item_title, image_url, link_url, description, publish_date,
        in_app_date, sub_section_id, type, duration, orig_url, sync;
    ....
    ....
}

我要排序名单listIB,其成员出版日期

I want to sort list "listIB" with its member "publish_date"

推荐答案

使用的SimpleDateFormat 来解析日期字符串,获得日期对象,面对以毫秒为单位的时间比较。

use SimpleDateFormat to parse the date string, get the Date object and confront the time in milliseconds in a comparator.

这篇关于已经按日期排序itemBean名单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆