Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

0 votes

When I close my android app or the system does, I need the data to be written to the database. What would be the best way to respond to destroying the app? I am currently overriding onDestroy, but I don't think that is the best solution.

asked ago in CSC490_Spring202021 by (421 points)

1 Answer

0 votes

I dont know this can answer your question or not, but when you need to go to another activity and want to come back to the previous one, you will do like this:
1. create a new intent to go to another activity with function startActivityForResult(intent,activity)
2. send data in that activity to the database
3. call back by using function finish();
4. calling data from previous activity by function onActivityResult()

answered ago by (216 points)
...