Reputation: 2247
I add a recycleView (MainActivity) to my application. When I touch an item an activity (ItemActivity) is called having some info about the item + an action button. I have a method that populates the recycleView within onCreate
(MainActivity) method.
I have installed it on two cellphones, one with Android 5.1 and the second with Android 4.2.
On 5.1, I choose an item, execute the action with the action button and back to the list (mainAcitivity) using the "Back Button". The onCreate
method is called, thus, the recycleView is updated.
On 4.2, I do the same thing but when I go back the onCreate
method is not called.
Maybe I'm doing something wrong?
The bottom line it, I need to reload the recycleView after the action.
Upvotes: 0
Views: 110
Reputation: 116
onCreate is called only when activity is created or was destroed. If you navigate back activity can still exist and your should use onStart to catch this. Or onResume.
Look here for activity lifecycle:
http://developer.android.com/reference/android/app/Activity.html
Upvotes: 1
Reputation: 338
Override Activity's onResume() method, call method to load recycleView in onResume.
Upvotes: 0