title: trouble in deletion from the database
body: <p>Getting the contacts from the phone  and displaying it in a list view, and marking the contacts and adding it to the list view, from there marked list view is adding and unmarked list view is deleteing.</p>
  
  <p>The code I used for this is..</p>
  
  <pre><code>        @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  View view = null;
  if (convertView == null) {
      x= position;
      LayoutInflater inflator = context.getLayoutInflater();
      view = inflator.inflate(R.layout.contactliststyle, null);
      final ViewHolder viewHolder = new ViewHolder();
      viewHolder.txtName = (TextView) view.findViewById(R.id.txtView_Name);
      viewHolder.txtNumber = (TextView)view.findViewById(R.id.txtView_Number);
      viewHolder.selection = (CheckBox)view.findViewById(R.id.checkbtn_selectContact);
      viewHolder.selection
              .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  
                  public void onCheckedChanged(CompoundButton buttonView,
                          boolean isChecked) {
                      ContactModel element = (ContactModel)viewHolder.selection
                              .getTag();
                      element.setSelected(buttonView.isChecked());
                      if(buttonView.isChecked())
                      {
                      String selectedName=element.getName();
                      String selectedNumber=element.getNumber();
                      System.out.println("etrtrt"+element.getName());
                      DatabaseHandler db = new DatabaseHandler(context);
  
                      Log.d("Insert: ", "Inserting ..");
                      db.addContact(new Contact(selectedName, selectedNumber));
  
                      }
                      else
                      {
                           String selectedName=element.getName();
                          String selectedNumber=element.getNumber();
                          System.out.println("Number"+selectedNumber);
                          System.out.println("Name"+selectedName);
                          DatabaseHandler db = new DatabaseHandler(context);
                          db.deleteContact(new Contact(selectedName,selectedNumber));
                      }
  
                  }
              });
  </code></pre>
  
  <p>The code in the openHelper class for deleting the contact is</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()) });
      System.out.println("Deleted");
      db.close();
  }
  </code></pre>
  
  <p>the contact is adding to the database perfectly but not deleting from the database...</p>