title: how to delete selected listview item from database
body: <p>how to delete listview selected possition id value from database my code just only listview position value which is not equal to database value i want to delete listview selected position value from listview also from database and show   KEY_TIME value of selected item in toast how to do that??</p>
  
  <pre><code>          msglist.setOnItemLongClickListener(new OnItemLongClickListener() {
     // setting onItemLongClickListener and passing the position to the function
            @Override
    public boolean onItemLongClick(AdapterView&lt;?&gt; arg0, View arg1,
          int position, long arg3) {
  
                DatabaseHandler db = new DatabaseHandler(MsgActivity.this);
  
  
          Log.d("LOGInG VALUE", "Value: " + String.valueOf(arg3));
  
  
                        db.Delete_Contact(position);
  
  
  
                return true;
     }
   });
  
  
     public class DatabaseHandler extends SQLiteOpenHelper {
  
      String CREATE_INBOX_TABLE = "CREATE TABLE " + TABLE_INBOX + "("
  + KEY_INBOXID + " INTEGER PRIMARY KEY," + KEY_MSG + " TEXT,"+ KEY_TIME + " TEXT" + ")";
  public void Delete_Contact(int id) {
  //   String string =String.valueOf(id);
      SQLiteDatabase db = this.getWritableDatabase();
      db.delete(TABLE_INBOX, KEY_INBOXID + " =? ",  new String[] { 
         String.valueOf(id) });
  
              db.close();
  }
  
  
      }
  </code></pre>