Back to project page counter.
The source code is released under:
GNU General Public License
If you think the Android project counter listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.krywitsk.countera1; /*from w w w .j a v a2s. co m*/ import java.util.ArrayList; import java.util.Date; public class Counter { //recording dates and times for each counter private String name; private ArrayList<Date> timeStamps; public Counter(String nameIn) { this.name = new String(nameIn); timeStamps = new ArrayList<Date>(); } public void incrementCount() { timeStamps.add(new Date()); } public Integer getCount() { return timeStamps.size(); } public ArrayList<Date> getTimeStamps() { return timeStamps; } public void addTimeStamp(Date dateIn) { timeStamps.add(dateIn); } public void addTimeStamp(String timeIn) { timeStamps.add(new Date(timeIn)); } public void resetCount() { timeStamps.clear(); } public String getName() { return name; } public void setName(String name) { this.name = new String(name); } public String convertToString() { StringBuilder temp = new StringBuilder(); temp.append(name); for(Date dates : timeStamps) { temp.append("%"); temp.append(dates.toString()); } return temp.toString(); } }