Question: I have 4 blocks, each with the same wrapper class. Inside of each of these blocks is an image. I need to pull the src from the img of each of these blocks and apply them as the background for these blocks.

Here is my code

```
$('.Home-Jump-Wrap').each(function() {
    var bannerImage = $(this).find(".Jump-Image img").attr("src");
    $(this).css("background-image", "url(" + bannerImage + ")");
    $(".Jump-Image").closest(".row-fluid-wrapper").remove();
});

```

Right now this code works, only instead of applying the src of each img in each block (all images are different), it only does the first one. It removes the images from all of the blocks but the last three blocks' backgrounds are empty. any ideas?

Answer: 
Remove the item from your model when `onClick` happens n call `notifyDatasetChanged()` for the same adapter

and in your case you are passing cursor directly to your custom adapter which is a very bad practice as in this case your connection with the db will stay open and can lead to Memory and DB issues

So you can create your own model (ArrayList) , get values from cursor, add them into your model,Close your db connection and pass that model to your adapter. and to remove a particular item remove that from your model and call `notifyDatasetChanged()`.(Note: Removing from model will only remove the data from list but not from db. In case you want to delete that data from your db, you also have to execute Delete Query )

for this : I don't want to delete it when I click on ListView item. I want to delete it only when I click on button in ListView item 

Go to your adapter class.. get the object instance over there in `OnGetView(...)` method and the the `onClickListener for the same over there`.

To delete row from DB you can use a unique id from db table like this

```
public void delete_byID(int id){
 sqLiteDatabase.delete(MYDATABASE_TABLE, KEY_ID+"="+id, null);
}

```

Where `MYDATABASE_TABLE` is your table to delete from.

```
KEY_ID is the name of the coloumn to put where condition.
id  is the unique id associated with the row you want to delete 

```

So in this case you will not need the cursor to delete a particular record
The reason that bindView method doesn't refresh by the db change is :
The cursor is steel the old cursor .
You need to requery the data base get new cursor and then
Call adapter.change cursor(passHereTheNewCursor)