Android Open Source - InitHub-Android Subject Database Helper






From Project

Back to project page InitHub-Android.

License

The source code is released under:

MIT License

If you think the Android project InitHub-Android 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.solutiosoft.android.inithub.dao;
// ww  w .j  a v a 2 s .  c om
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class SubjectDatabaseHelper extends SQLiteOpenHelper {
    private static final String TAG = "SubjectDatabaseHelper";
  
  // Database Version
    private static final int DATABASE_VERSION = 1;
 
    // Database Name
    private static final String DATABASE_NAME = "InitHub";
    
    // subject table name
    public static final String TABLE_SUBJECT = "subject";
    
    // subject Table Columns names
    public static final String KEY_ID = "id";
    public static final String KEY_SHORT_DESC = "short_desc";
    public static final String KEY_LONG_DESC = "long_desc";
    public static final String KEY_INITIATIVE = "initiative_short_desc";
    public static final String KEY_FIRST_NAME = "first_name";
    public static final String KEY_LAST_NAME = "last_name";
    
  public SubjectDatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
        Log.d(TAG,"------------ SubjectDatabaseHelper contructor");
    }

  @Override
  public void onCreate(SQLiteDatabase db) {
    Log.d(TAG,"------------ onCreate");
    String CREATE_SUBJECT_TABLE = "CREATE TABLE " + TABLE_SUBJECT + "("
                + KEY_ID + " INTEGER PRIMARY KEY," + KEY_SHORT_DESC + " TEXT,"
                + KEY_LONG_DESC + " TEXT," + KEY_INITIATIVE + "TEXT,"
                + KEY_FIRST_NAME + "TEXT," + KEY_LAST_NAME + "TEXT," + ")";
        db.execSQL(CREATE_SUBJECT_TABLE);
    
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_SUBJECT);
     
        // Create tables again
        onCreate(db);
    
  }

}




Java Source Code List

com.solutiosoft.android.inithub.AlarmReceiver.java
com.solutiosoft.android.inithub.ApiHelper.java
com.solutiosoft.android.inithub.BootupReceiver.java
com.solutiosoft.android.inithub.Constants.java
com.solutiosoft.android.inithub.Utils.java
com.solutiosoft.android.inithub.dao.InitHubDatabaseManager.java
com.solutiosoft.android.inithub.dao.SubjectDatabaseHelper.java
com.solutiosoft.android.inithub.entities.Message.java
com.solutiosoft.android.inithub.entities.Subject.java
com.solutiosoft.android.inithub.entities.User.java
com.solutiosoft.android.inithub.provider.MessageProvider.java
com.solutiosoft.android.inithub.provider.SubjectProvider.java
com.solutiosoft.android.inithub.service.MessageIntentService.java
com.solutiosoft.android.inithub.service.SubjectIntentService.java
com.solutiosoft.android.inithub.ui.InboxActivity.java
com.solutiosoft.android.inithub.ui.LoginActivity.java
com.solutiosoft.android.inithub.ui.MessageActivity.java
com.solutiosoft.android.inithub.ui.MessageAddActivity.java
com.solutiosoft.android.inithub.ui.SettingsActivity.java
com.solutiosoft.android.inithub.ui.SplashActivity.java
com.solutiosoft.android.inithub.ui.SubjectActivity.java