title: perform delete row in sqlite table
body: <p>i have one table call listTable and productTable . I perform sqlite delete function in listTable , but something wrong in my coding . Inside productTable have Foreign key reference to primary key in listTable .</p>
  
  <p>SQLiteHelper.java</p>
  
  <pre><code>     public class SQLiteHelper extends SQLiteOpenHelper {
              public static final String dbName = "shoppingDB1.db";
              public static final int dbVersion = 1;
              public static final String listTable = "ShoppingList";
              public static final String listId = "ShopingList_Id";
              public static final String listName = "ShopingList_Name";
  
              public static final String productTable = "Product";
              public static final String product_id = "Product_Id";
              public static final String productName = "Product_Name";
              public static final String product_FId = "Product_FId";
              private static final String CREATE_SHOPPLINGLIST_TABLE = "CREATE TABLE IF NOT EXISTS "
                      + listTable
                      + " ("
                      + listId
                      + " INTEGER PRIMARY KEY AUTOINCREMENT, "
                      + listName
                      + " TEXT ")";
  
              private static final String CREATE_PRODUCT_TABLE = "CREATE TABLE  IF NOT EXISTS "
                      + productTable
                      + " ("
                      + product_id
                      + " INTEGER PRIMARY KEY AUTOINCREMENT, "
                      + productName
                      + " TEXT, "+ product_FId
                  + " INTEGER NOT NULL,   "
                               FOREIGN KEY ("
                  + product_FId
                  + ") REFERENCES "
                  + listTable
                  + " ("
                  + listId
                  + ")
           public void onCreate(SQLiteDatabase db) {
          db.execSQL(CREATE_SHOPPLINGLIST_TABLE);
          db.execSQL(CREATE_PRODUCT_TABLE);
  }
          public void onOpen(SQLiteDatabase db) {
          super.onOpen(db);
          if (!db.isReadOnly()) {
              // Enable foreign key constraints
              db.execSQL("PRAGMA foreign_keys=ON;");
          }
      }
  </code></pre>
  
  <p>ComicsData.java</p>
  
  <pre><code>public class ComicsData {
  public ComicsData(Context context) {
          dbHelper = new SQLiteHelper(context);
      }
  
  public void open() throws SQLException {
          database = dbHelper.getWritableDatabase();
      }
  public void deleteList(String myid) {
          // TODO Auto-generated method stub
          String[] arg={myid};
          try{
          database.delete(SQLiteHelper.listTable, SQLiteHelper.listId+ " = ?",arg);
          }catch(Exception e){
              Log.e("cannot", e.toString());
          }
      }
  </code></pre>
  
  <p>error message</p>
  
  <pre><code>12-02 17:27:46.232: E/error(21668): android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
  </code></pre>
  
  <p>deleteList(String myid) will display error if there have product inside the list .
  anyone know what is my problem ? should the foreign key problem  . I passing listId to deleteList(String myid)</p>