How to refresh activity without losing all data?
<p>I want to delete an object by clicking in some ImageButton. When i do that the item only disapears when i perform another action. I made my research and it was possible to change that by refreshing the activity. The problem is that when i do that, all the other items also disapear from my list. I tought about adding the objects to a Table by SQLite and then retrieving them again. Is there an easier approach?</p>

<p>Thank you.</p>

<p><em>EDIT</em></p>

<p><a href="https://i.stack.imgur.com/rxAOj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rxAOj.png" alt="enter image description here"></a></p>

<p>When i click on a cross of kiwi to remove it</p>

<p>if i have this : </p>

<pre><code> public void removeProduct(View v) {

    Integer position = (Integer) v.getTag();

    Product p1 = (Product) adapter.getItem(position);
    productsGridView.remove(p1);
 }
</code></pre>

<p>it will remove but only if i click on other part of the app, so will not be immediatelly.</p>

<p>I'm looking for a way to do it immediatelly. I was thinking about this </p>

<pre><code>public void removeProduct(View v) {

    Integer position = (Integer) v.getTag();

    Product p1 = (Product) adapter.getItem(position);
    productsGridView.remove(p1);

    Intent intent = getIntent();
    finish();
    startActivity(intent);
    }
</code></pre>

<p>but then instead of morango and banana as a result i get 0 products in the list...</p>