to top
Android APIs
public class

DateSorter

extends Object
java.lang.Object
   ↳ android.webkit.DateSorter

Class Overview

Sorts dates into the following groups: Today Yesterday seven days ago one month ago older than a month ago

Summary

Constants
int DAY_COUNT must be >= 3
Public Constructors

? Examples
DateSorter( Context context)
Public Methods

? Examples
long getBoundary(int index)

? Examples
int getIndex(long time)

? Examples
String getLabel(int index)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int DAY_COUNT

Added in API level 1

must be >= 3

Constant Value: 5 (0x00000005)

Public Constructors

public DateSorter (Context context)

Added in API level 1

Parameters
context Application context

Public Methods

public long getBoundary (int index)

Added in API level 1

Parameters
index date bin index as returned by getIndex()
Returns
  • date boundary at given index

public int getIndex (long time)

Added in API level 1

Parameters
time time since the Epoch in milliseconds, such as that returned by Calendar.getTimeInMillis()
Returns
  • an index from 0 to (DAY_COUNT - 1) that identifies which date bin this date belongs to

public String getLabel (int index)

Added in API level 1

Parameters
index date bin index as returned by getIndex()
Returns
  • string label suitable for display to user
No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.