title: How to create a local database in android for my application
body: <p>I want to create a simple database for my android application in sqlite. I just want to add my values to the table.</p>
  
  <p>This is my code but this is not working for me because the table is not shown at DDMS.</p>
  
  <pre><code>public class QuickSubmitContext extends SQLiteOpenHelper {
      private static final int DATABASE_VERSION = 1;
      private static final String DATABASE_NAME = "submitManager";
      private static final String TABLE_CONTACTS = "submit";
      private static final String KEY_ID = "id";
      private static final String KEY_PH_NO = "phone_number";
      private static final String KEY_DNCA = "donotca";
      private static final String KEY_CA = "callagain";
      private static final String KEY_NOTE = "note";
      public QuickSubmitContext(Context context) {
          super(context, DATABASE_NAME, null, DATABASE_VERSION);
      }
      @Override
      public void onCreate(SQLiteDatabase db) {
          String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_CONTACTS + "("
                  + KEY_ID + " INTEGER PRIMARY KEY," + KEY_PH_NO + " TEXT,"
                  + KEY_DNCA + " TEXT," + KEY_CA + " TEXT," + KEY_NOTE + " TEXT" + ")";
              db.execSQL(CREATE_CONTACTS_TABLE);
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
          db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTACTS);
  
          // Create tables again
          onCreate(db);
      }
  }
  </code></pre>
  
  <p>Logcat</p>
  
  <pre><code>10-21 04:39:00.230: E/AndroidRuntime(835): FATAL EXCEPTION: main
  10-21 04:39:00.230: E/AndroidRuntime(835): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aspeage.quikw/com.aspeage.quikw.FragmentLayout}: java.lang.NullPointerException
  10-21 04:39:00.230: E/AndroidRuntime(835):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at android.os.Handler.dispatchMessage(Handler.java:99)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at android.os.Looper.loop(Looper.java:137)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at android.app.ActivityThread.main(ActivityThread.java:5041)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at java.lang.reflect.Method.invokeNative(Native Method)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at java.lang.reflect.Method.invoke(Method.java:511)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at dalvik.system.NativeStart.main(Native Method)
  10-21 04:39:00.230: E/AndroidRuntime(835): Caused by: java.lang.NullPointerException
  10-21 04:39:00.230: E/AndroidRuntime(835):  at com.aspeage.quikw.FragmentLayout.onCreate(FragmentLayout.java:79)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at android.app.Activity.performCreate(Activity.java:5104)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  10-21 04:39:00.230: E/AndroidRuntime(835):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
  10-21 04:39:00.230: E/AndroidRuntime(835):  ... 11 more
  10-21 04:39:07.090: I/Process(835): Sending signal. PID: 835 SIG: 9
  10-21 04:39:13.050: E/Trace(866): error opening trace file: No such file or directory (2)
  </code></pre>