So for my app, I have a recyclerView which holds a list of Albums (a parcelable object in my program). Each Album contains an ArrayList of Photos(another parcelable object). In my current setup, when a user taps an album a seperate activity is opened where all the photos of said Album will be displayed! Now currently i am passing my entire album to the photos activity where a user can click a button and my code access the arrayList of the album and adds a photo to it. Now when I return to my album activity, the album has not been at all modified (i.e no photos have been added). My question is whether what I am doing makes sense and modifying an object in a separate activity will change its state in the current activity!
Asked
Active
Viewed 26 times
1 Answers
0
Use StartAcitvityForResult()
to starting new activity. In new activity make all changes in your arrayList. In when your new acitvity will finish, send result back to previous activity. Where you can update your list. Here is example of startActivityForResult

Mubashar Javed
- 749
- 1
- 5
- 12
-
Thank you thats what I am going to do now. The reason I asked this question was because I was making a similar app in Javafx and there I just passed objects between stages and modified them as I wished (in javafx, you dont have to parcelize objects to pass them around). My question really was wheather a similar effect can be achieved in Android using parcelable objects! – user9022423 Nov 28 '17 at 21:29