Asume I have two Activities:
- MainActivity: Shows a list of items that are stored in a SQLiteDB
- NotificationActivity: Activity from which the user can add an item to the database.
NotificationActivity is opened when a user clicks on the notification. Next, the user adds an item to the database and the NotificationActivity is closed. How can I inform my MainActivity that an object was added?
What won't work:
I can't use a broadcastreiceiver because it is unregisterd when the activity is paused, which ofcourse happend when my NotificationActivity opens.
I can't use
startActivityForResult
because NotificationActivity opens from a notification.I can't use MainActivity its
onResume
because I don't to update the list every time the MainActivity is resumed.
So how can I send a message/object to my MainActivity from my NotificationActivity that was opened from a notification?