Android Open Source - counter Counter






From Project

Back to project page counter.

License

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.

Java Source Code

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




Java Source Code List

com.krywitsk.countera1.CounterArrayController.java
com.krywitsk.countera1.Counter.java
com.krywitsk.countera1.MainActivity.java
com.krywitsk.countera1.StatsActivity.java
com.krywitsk.countera1.StatsGenerator.java