Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class Main {
    public static final String TABLE_NAME = "foot_record";

    public static ArrayList<String> queryDay(SQLiteDatabase db) {
        ArrayList<String> dayList = new ArrayList<String>();

        String sqlStr = "select distinct date from " + TABLE_NAME + " order by _id desc";

        Cursor cursor = db.rawQuery(sqlStr, null);

        while (cursor.moveToNext()) {
            dayList.add(cursor.getString(0));
        }

        return dayList;
    }
}