Counter Application – Part Two

As mentioned in previous post that you can find here, this post will be about persisting our counter information into SQLite database that is part of Android system.

Let’s start this post with creating pojo object that will hold counter data:

package com.anjadev.clickcounter.pojo;

import java.util.Date;

public class Counter {

private String title;
private int count=0;
private long counterId;
private String color;
private int increment;
private int initialValue = 0;

public Counter(String title, int count, String color, int increment, int initialValue){
this.title = title;
this.count = count;
this.color = color;
this.increment = increment;
this.startDateTime = new Date(System.currentTimeMillis());
this.initialValue = initialValue;

public long getCounterId() {
return counterId;

public void setCounterId(long counterId) {
this.counterId = counterId;

public String getTitle() {
return title;

public void setTitle(String title) {
this.title = title;

public int getCount() {
return count;

public void setCount(int count) {
this.count = count;

public String getColor() {return color;}

public void setColor(String color) {this.color = color;}

public void setIncrement(int increment){this.increment = increment;}

public int getIncrement(){return this.increment;}

public void setInitialValue(int initialValue){this.initialValue = initialValue;}

public int getInitialValue(){return this.initialValue;}

Posted in General Programming Tagged with: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.