Android Open Source - GeoTasker Database Helper






From Project

Back to project page GeoTasker.

License

The source code is released under:

GNU General Public License

If you think the Android project GeoTasker 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.fjaviermo.database;
/*from  w w w .j  a v a  2s .  com*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelper extends SQLiteOpenHelper {

  private static final String DATABASE_NAME = "geotasker.db";
  private static final int DATABASE_VERSION = 1;
    
  public DatabaseHelper(Context context) {
      super(context, DATABASE_NAME, null, DATABASE_VERSION);
  }

  @Override
  public void onCreate(SQLiteDatabase database) {
    
    if (!database.isReadOnly()) {
      // Enable foreign key constraints
      database.execSQL("PRAGMA foreign_keys = ON;");
      Log.i("TAG", "FOREIGN KEY constraint enabled!");
    }      

    ProfilesSQLiteHelper.onCreate(database);
    LocationSQLiteHelper.onCreate(database);
  }

  @Override
  public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
    ProfilesSQLiteHelper.onUpgrade(database, oldVersion, newVersion);
    LocationSQLiteHelper.onUpgrade(database, oldVersion, newVersion);
  }      
}




Java Source Code List

com.fjaviermo.adapter.ProfileAdapter.java
com.fjaviermo.dao.LocationDataSource.java
com.fjaviermo.dao.ProfilesDataSource.java
com.fjaviermo.database.DatabaseHelper.java
com.fjaviermo.database.LocationSQLiteHelper.java
com.fjaviermo.database.ProfilesSQLiteHelper.java
com.fjaviermo.geotasker.AddProfileDialogFragment.java
com.fjaviermo.geotasker.MainActivity.java
com.fjaviermo.geotasker.ProfileFragment.java
com.fjaviermo.geotasker.ProfileListFragment.java
com.fjaviermo.model.Location.java
com.fjaviermo.model.Profile.java