I have a list in my app. In another activity, user deletes a row from database and it returns to the main activity (I use finish() here). When it returns back, the row that has been removed from database is still on the list. If user presses refresh button, it disappears.
How can I refresh it automatic?
Override your original Activity's (the one that is showed when the user presses back) onResume(), so it looks like:
@Override
protected void onResume()
{
refreshListMethod();
super.onResume();
}
refreshListMethod(); is whatever approach you chose to refresh the List since you say:
user presses refresh button, it disappears.
So turn that approach into a method so you can use it wherever needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With