Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    private static final String TABLE_CONTENT_HELP = "content_help_table";
    private static final String PAGE_ID = "page_id";
    private static final String PAGE_LANGUAGE = "page_language";

    public static boolean isExist(SQLiteDatabase db, String pageId, String lang) throws SQLException {
        boolean itemExist = false;

        Cursor c = db.query(TABLE_CONTENT_HELP, null, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?",
                new String[] { pageId, lang }, null, null, null);

        if ((c != null) && (c.getCount() > 0)) {
            itemExist = true;
        }
        c.close();
        return itemExist;
    }
}