I am building an application that has a screen that needs to be filled with data. At some point there's a button called "Add Category" which will redirect the app to another screen where the users will be able to add some custom categories and after selecting all the ones they will click on "save" and be redirected to the previous screen. The thing is that I want the screen to still have the data inserted previously and, mainly, the new categories that were just added. I would like to ask you all what is the best way to do that? I want to have an general idea about the structure of the activities how can I do that and the things I would have to use. I know that when I go back without finishing an activity I will still have the fields filled, my main concern is about getting what was inserted. If I use intent when he user presses the back button the data will be passed but how can I make the previous screen receive them without losing what was inserted previously?
Asked
Active
Viewed 80 times
0
-
You can use Second activity as result activity, when user insert data into category and save it, return the latest data, and on first activity receive through onActivityResult... sorry for bad English... – Azim Shaikh Aug 28 '17 at 14:13
-
Use startActivityForResult() instead of startActivity() https://stackoverflow.com/questions/920306/sending-data-back-to-the-main-activity-in-android – Kunal Puri Aug 28 '17 at 14:14