Android Open Source - GreenerGasPedal Data Helper






From Project

Back to project page GreenerGasPedal.

License

The source code is released under:

GNU General Public License

If you think the Android project GreenerGasPedal 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 name.nanek.greenerpedal.db.model.dao;
//from  w  ww  .j  ava2 s .c  om
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DataHelper {

    private static final String DATABASE_NAME = "greener_pedal.db";

    private static final int DATABASE_VERSION = 1;

    public final ReadingDao readings;

    private SQLiteDatabase mDB;

    public DataHelper(final Context context) {

        readings = new ReadingDao();
        OpenHelper openHelper = new OpenHelper(context);
        mDB = openHelper.getWritableDatabase();
    }

    private class OpenHelper extends SQLiteOpenHelper {

        OpenHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
             readings.onCreate(db);
        }

        @Override
        public void onOpen(SQLiteDatabase db) {
            super.onOpen(db);
             readings.onOpen(db);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
             readings.onUpgrade(db, oldVersion, newVersion);
        }
    }

    public void close() {
        mDB.close();
        mDB = null;
    }
}




Java Source Code List

name.nanek.greenerpedal.GreenerPedalApp.java
name.nanek.greenerpedal.activity.DisplayReadingsActivity.java
name.nanek.greenerpedal.activity.EditPrefsActivity.java
name.nanek.greenerpedal.activity.GraphAndShareActivity.java
name.nanek.greenerpedal.activity.support.APISafeKeyguardHider.java
name.nanek.greenerpedal.activity.support.BitmapUtil.java
name.nanek.greenerpedal.activity.support.LogLine.java
name.nanek.greenerpedal.activity.support.LowPassFilter.java
name.nanek.greenerpedal.activity.support.MessageOnlyFormatter.java
name.nanek.greenerpedal.activity.support.Prefs.java
name.nanek.greenerpedal.activity.support.ScreenLock.java
name.nanek.greenerpedal.activity.support.Sensors.java
name.nanek.greenerpedal.activity.support.ShareUtil.java
name.nanek.greenerpedal.activity.support.Trigger.java
name.nanek.greenerpedal.activity.support.TriggersResult.java
name.nanek.greenerpedal.activity.support.Views.java
name.nanek.greenerpedal.db.model.Reading.java
name.nanek.greenerpedal.db.model.dao.DataHelper.java
name.nanek.greenerpedal.db.model.dao.ReadingDao.java
name.nanek.greenerpedal.db.model.dao.support.DateUtil.java
name.nanek.greenerpedal.db.model.dao.support.DbUtil.java