title: How to call delete function in sqlite
body: <p>I want to use below given delete function from my Database Handler file. When I am implementing it javaNullpointerException is coming. I am definitely missing something.</p>
  
  <p><strong>Delete Function:</strong></p>
  
  <pre><code>// Deleting single contact
  public void deleteContact(Contact contact) {
      SQLiteDatabase db = this.getWritableDatabase();
      db.delete(TABLE_CONTACTS, KEY_ID + " = ?",new String[] { String.valueOf(contact.getID()) });
      db.close();
  }
  </code></pre>
  
  <p><strong>I am trying to use as:</strong></p>
  
  <pre><code>     DatabaseHandler db = new DatabaseHandler(this);
  Contact pm = null;
  Intent i;
  i = getIntent();
  pm._id= i.getExtras().getInt("id");
  pm._name = i.getExtras().getString("name");
  pm._phone_number = i.getExtras().getString("phone_number");
  
          // **Some problem is here I am not getting it
  
                          db.deleteContact(pm);
                          Toast.makeText(getApplicationContext(),"Deleted..",Toast.LENGTH_SHORT).show();
  </code></pre>
  
  <p><strong>LOGCAT:</strong></p>
  
  <pre><code>08-19 01:15:00.726: E/AndroidRuntime(12657): FATAL EXCEPTION: main
  08-19 01:15:00.726: E/AndroidRuntime(12657): java.lang.NullPointerException
  08-19 01:15:00.726: E/AndroidRuntime(12657):    at com.parth.targetthebudget.ViewContact$ListAdapter$2$1.onClick(ViewContact.java:151)
  08-19 01:15:00.726: E/AndroidRuntime(12657):    at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:163)
  08-19 01:15:00.726: E/AndroidRuntime(12657):    at android.os.Handler.dispatchMessage(Handler.java:99)
  08-19 01:15:00.726: E/AndroidRuntime(12657):    at android.os.Looper.loop(Looper.java:130)
  08-19 01:15:00.726: E/AndroidRuntime(12657):    at android.app.ActivityThread.main(ActivityThread.java:3687)
  08-19 01:15:00.726: E/AndroidRuntime(12657):    at java.lang.reflect.Method.invokeNative(Native Method)
  08-19 01:15:00.726: E/AndroidRuntime(12657):    at java.lang.reflect.Method.invoke(Method.java:507)
  08-19 01:15:00.726: E/AndroidRuntime(12657):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
  08-19 01:15:00.726: E/AndroidRuntime(12657):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
  08-19 01:15:00.726: E/AndroidRuntime(12657):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>