title: Problem updating a SQLite Database
body: <p>I have a list view that is populated from my personal SQLite DB that shows information about an event.  I am trying to create a way to "favorite" this event using a checkbox on the event's description page.  The code will try to update the database when a user checks the checkbox and then initiates the onPause()</p>
  
  <p>I have looked up some examples of updating rows in a database, but no matter what I try I seem to always get stuck with a NullPointerException. </p>
  
  <p>Let me know if there is any other code that you would need to look at to help me resolve this problem.</p>
  
  <p>Here is the code I call when the user moves away from the description activity to see if they have checked the checkbox:</p>
  
  <pre><code>@Override
  protected void onPause() {
      super.onPause();
      DataBaseHelper myDbHelper = new DataBaseHelper(this);
      if (panelCheckBox.isChecked()) {
          int mySchedule = 1;
          myDbHelper.updateRow(mRowId, mySchedule);
      }
  </code></pre>
  
  <p>And here is the updateRow code in the DataBaseHelper</p>
  
  <pre><code>public void updateRow(long rowId, Integer mySchedule) {
      if(mySchedule != null){
      ContentValues args = new ContentValues();
      args.put("mySchedule", mySchedule);
      myDataBase.update(DATABASE_PANELS_TABLE, args, "_id=" + rowId, null);
      }
  }
  </code></pre>
  
  <p>Here is the error from logcat:</p>
  
  <pre><code>ERROR/AndroidRuntime(689): Uncaught handler: thread main exiting due to uncaught exception
  
  ERROR/AndroidRuntime(689): java.lang.RuntimeException: Unable to pause activity {com.tagrost.AndroidConventionApp/com.tagrost.AndroidConventionApp.PanelDescActivity}: java.lang.NullPointerException
  
  ERROR/AndroidRuntime(689):     at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3162)
  
  ERROR/AndroidRuntime(689):     at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3119)
  
  ERROR/AndroidRuntime(689):     at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3102)
  
  ERROR/AndroidRuntime(689):     at android.app.ActivityThread.access$2400(ActivityThread.java:119)
  
  ERROR/AndroidRuntime(689):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1874)
  
  ERROR/AndroidRuntime(689):     at android.os.Handler.dispatchMessage(Handler.java:99)  
  
  ERROR/AndroidRuntime(689):     at android.os.Looper.loop(Looper.java:123)
  
  ERROR/AndroidRuntime(689):     at android.app.ActivityThread.main(ActivityThread.java:4363)
  
  ERROR/AndroidRuntime(689):     at java.lang.reflect.Method.invokeNative(Native Method)  
  
  ERROR/AndroidRuntime(689):     at java.lang.reflect.Method.invoke(Method.java:521)
  
  ERROR/AndroidRuntime(689):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860
  
  ERROR/AndroidRuntime(689):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  
  ERROR/AndroidRuntime(689):     at dalvik.system.NativeStart.main(Native Method)
  
  ERROR/AndroidRuntime(689): Caused by: java.lang.NullPointerException
  
  ERROR/AndroidRuntime(689):     at com.tagrost.AndroidConventionApp.DataBaseHelper.updateRow(DataBaseHelper.java:198)
  
  ERROR/AndroidRuntime(689):     at com.tagrost.AndroidConventionApp.PanelDescActivity.onPause(PanelDescActivity.java:67)  
  
  ERROR/AndroidRuntime(689):     at android.app.Activity.performPause(Activity.java:3782)  
  
  ERROR/AndroidRuntime(689):     at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1190)
  
  ERROR/AndroidRuntime(689):     at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3149)
  </code></pre>