Android activity activity ends previous activity
I have an activity where you can click on a product and it adds it to the cart, then a button is clicked to check where the new activity starts, this exercise lists everything in the cart with the option to delete an item, If ALL items are removed, I I call finish () on this activity to go back to the previous activity, which lists all the products.
The problem is that this previous step still states that X items have been selected, how can I force this to refresh or reload?
Many thanks.
source to share
You have to put your update code inside onResume
your Activity
.
Look at the activity lifecycle here for more information: http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle
source to share
Have a look at functions startActivityForResult
and onActivityResult
if you want to feed information from child activity back to parent activity.
onResume
is called every time a task / app becomes active (e.g. turn off / on the screen, switch to your app using the task switcher, etc.) and you cannot refresh the page in all of these cases.
source to share