title: Return true if value is inserted to table in sqlite in android
body: <p>How to check if value is inserted to sqlite database. Following is my code.</p>
  
  <pre><code>   public Boolean addToWishList(ShopingCartModel shopingCartModel) {
  
          SQLiteDatabase db = this.getWritableDatabase();
          ContentValues values = new ContentValues();
          values.put(KEY_PRODUCT_ID,shopingCartModel.getId());
          values.put(KEY_TITLE, shopingCartModel.getCart_title());
          values.put(KEY_DESC, shopingCartModel.getCart_desc());
          // Inserting Row
          db.insert(TABLE_WISHLIST, null, values);
          db.close(); // Closing database connection
  
          return true // if value inserted
      }
  </code></pre>
  
  <p>I want to check it something like this, if data is inserted return true, else return false.</p>
  
  <pre><code>if (db.addToWishList(shopingCartModel)) {
                      wishlist.setTag("selected");
                      wishlist.setImageResource(R.drawable.ic_favorite_blue_24dp);
                      Toast.makeText(getApplicationContext(), "Added to wishlist", Toast.LENGTH_SHORT).show();
                  }
  </code></pre>