Android Open Source - Now_Manager Main Database Helper






From Project

Back to project page Now_Manager.

License

The source code is released under:

Apache License

If you think the Android project Now_Manager 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.collinguarino.nowmanager.provider;
//ww w  .  ja  v  a2  s . com
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Helper class that actually creates and manages the provider's underlying data repository.
 */
public final class MainDatabaseHelper extends SQLiteOpenHelper {

    // Defines the database name
    static final String DBNAME = "nowManagerDb";

    /*
     * Instantiates an open helper for the provider's SQLite data repository
     * Do not do database creation and upgrade here.
     */
    public MainDatabaseHelper(Context context) {
        super(context, DBNAME, null, 7); // increment database version (last param)
    }

    /*
     * Creates the data repository. This is called when the provider attempts to open the
     * repository and SQLite reports that it doesn't exist.
     */
    public void onCreate(SQLiteDatabase db) {
        // Creates the main table
        db.execSQL(Contracts.TimeCards.SQL_CREATE_MAIN);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        if (oldVersion == 6 && newVersion >= 7) {
            db.execSQL("ALTER TABLE " + "timeCards" + " ADD COLUMN " + "address" + " string");
            db.execSQL("UPDATE " + "timeCards"  + " SET " +
                    "address" + "= null");
        }
    }
}




Java Source Code List

com.collinguarino.nowmanager.AsyncGPSLog.java
com.collinguarino.nowmanager.EditTextBackEvent.java
com.collinguarino.nowmanager.EditTextMovement.java
com.collinguarino.nowmanager.SwipeDismissListViewTouchListener.java
com.collinguarino.nowmanager.TimeCardAdapter.java
com.collinguarino.nowmanager.TimeCardObject.java
com.collinguarino.nowmanager.floating.AddFloatingActionButton.java
com.collinguarino.nowmanager.floating.FloatingActionButton.java
com.collinguarino.nowmanager.floating.FloatingActionsMenu.java
com.collinguarino.nowmanager.provider.Contracts.java
com.collinguarino.nowmanager.provider.MainDatabaseHelper.java
com.collinguarino.nowmanager.provider.NowManagerProvider.java
com.collinguarino.nowmanager.ui.ActivityMain.java
com.collinguarino.nowmanager.ui.ActivitySettings.java
com.collinguarino.nowmanager.ui.Dialogs.java