Android Open Source - android-project My S Q Lite Helper






From Project

Back to project page android-project.

License

The source code is released under:

GNU General Public License

If you think the Android project android-project 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 pl.wroc.pwr.patryk;
/*w  w  w .jav  a2 s. c  o  m*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class MySQLiteHelper extends SQLiteOpenHelper {

  public static final String TABLE_COORDINATES = "coordinates";
  public static final String COLUMN_ID = "_id";
  public static final String COLUMN_LATITUDE = "latitude";
  public static final String COLUMN_LONGITUDE = "longitude";
  public static final String COLUMN_ALTITUDE = "altitude";

  private static final String DATABASE_NAME = "coordinates.db";
  private static final int DATABASE_VERSION = 1;
  
  // Database creation sql statement
  private static final String DATABASE_CREATE = 
      "create table "   + TABLE_COORDINATES + "(" + 
      COLUMN_ID       + " INTEGER primary key autoincrement, " + 
      COLUMN_LATITUDE   + " REAL, " + 
      COLUMN_LONGITUDE   + " REAL, " + 
      COLUMN_ALTITUDE   + " REAL);";

  public MySQLiteHelper(Context context){
      super(context, DATABASE_NAME, null, DATABASE_VERSION);
  }
  
  public MySQLiteHelper(Context context, String name, CursorFactory factory, int version) {
    super(context, name, factory, version);
  }

  @Override
  public void onCreate(SQLiteDatabase database) {
      database.execSQL(DATABASE_CREATE);
  }

  @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    Log.w(MySQLiteHelper.class.getName(),
        "Upgrading database from version " + oldVersion + " to "
            + newVersion + ", which will destroy all old data");
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_COORDINATES);
    onCreate(db);
  }

}




Java Source Code List

pl.wroc.pwr.patryk.Coordinate.java
pl.wroc.pwr.patryk.CoordinatesDataSource.java
pl.wroc.pwr.patryk.MainActivity.java
pl.wroc.pwr.patryk.MyArrayAdapter.java
pl.wroc.pwr.patryk.MyLocationListener.java
pl.wroc.pwr.patryk.MySQLiteHelper.java
pl.wroc.pwr.patryk.RunningChangeEvent.java
pl.wroc.pwr.patryk.RunningListenerImpl.java
pl.wroc.pwr.patryk.RunningListener.java