I am making a simple online book store app. The two activities I want to share information between are activity A which is a recyclerView filled with books and activity B which displays more information about a book when said book is clicked in activity A. I want to add some functionality where when you click on the author name of a book in activity B, the application will send the authors name back to activity A and filter the books in such a way that only books from the chosen author are showed.
Filtering the data is an easy task to solve. However I do not know how to get the author name back to activity A. Is using an intent the right call here? Will the intent not start an entirely new A activity? Is it possible to send information to an activity running in the background and somehow receive it in onResume()? Is there something else I can use?
Similar questions did not seem helpful so I apologize for repeating this. I don't see any reason to provide any code. Will do so if anyone asks.
EDIT: Solution of a follow up problem I received after using startactivityforresult()
I did not mention it above, but I am using a recycler view adapter class to get from activity A to activity B. This made it so that I was not able to change startActivity() to startactivityforresult().
My original piece of code was:
mContext.startActivity(intent);
to solve the problem it was changed to the following:
((Activity) mContext).startActivityForResult(intent, 1);