Android Open Source - Grocery-List D B Helper






From Project

Back to project page Grocery-List.

License

The source code is released under:

MIT License

If you think the Android project Grocery-List 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.evanwaldron.grocerylist.storage;
//  ww  w . j a  v a  2  s .c  o m
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * Created by Evan on 9/28/14 12:08 PM.
 */
public class DBHelper extends SQLiteOpenHelper {

    private static final String LOG_TAG = DBHelper.class.getSimpleName();

    private static final String DB_NAME = "grocery_list";

    private static final String GROCERY_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " + Storage.Groceries.TABLE_NAME + "(" +
            Storage.Groceries.ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
            Storage.Groceries.NAME + " TEXT)";

    public DBHelper(Context context) {
        super(context, DB_NAME, null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(GROCERY_TABLE_CREATE);
        Log.i(LOG_TAG, "Grocery table created");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}




Java Source Code List

com.evanwaldron.grocerylist.ApplicationTest.java
com.evanwaldron.grocerylist.storage.DBHelper.java
com.evanwaldron.grocerylist.storage.GroceryContentProvider.java
com.evanwaldron.grocerylist.storage.Storage.java
com.evanwaldron.grocerylist.ui.GroceryListActivity.java
com.evanwaldron.grocerylist.ui.GroceryListFragment.java