Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Licensed under the Apache License, Version 2.0

import android.database.Cursor;

import android.database.sqlite.SQLiteDatabase;

public class Main {
    public static long selectTopTableId(SQLiteDatabase mDB, String tableName, String tableIdColumn) {
        long topTaskId = 1;
        Cursor cursor = mDB.query(tableName, new String[] { tableIdColumn }, null, null, null, null,
                tableIdColumn + " DESC LIMIT 1");
        assert null != cursor;
        try {
            if (cursor.moveToFirst()) {
                topTaskId = cursor.getLong(0);
            }
        } finally {
            cursor.close();
        }
        return topTaskId;
    }
}