I have an activity where you can click on a product and it adds it to a basket, a button is then pressed to checkout where a new activity is started, this activity lists everything in the basket with an option to remove the item. If ALL items are removed I am calling finish() on this activity to go back to the previous activity that listed all the products.
The problem is that this previous activity still says X items have been selected, how can I get this to update or to reload?
You should put your refresh code inside the onResume method of your Activity.
Take a look at the Activity Lifecycle here for more information: http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle
Look at startActivityForResult and onActivityResult functions if you want to return information from child activity back to a parent activity.
onResume is called every time the task/app becomes active (for ex: screen off/on, switching to your app using task switcher etc) and you may not want to refresh the page in all these cases.
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