How to send a view from module to different module

from the CommonsWare Community archives

At April 23, 2020, 5:12am, islam.farid2100 asked:

I want send a view to be rendered as a part of a activity list in different module, without depending on each other I mean I do not want to their module to depend on my module.
Also can I send the view in a reactive way like sending the normal objects, or may be expected problems or memory leaks may happen.

Please be notified that I can use the app module as a middle layer to take from my module the view and sent it to the other module; however, I want to ask may be there are different ideas.

I know every time I do not have a code to share, I just want to ask about ideas, and it is ok if it is not part of the subscription to answer these kind of questions :). Thanks in advance :).


At April 23, 2020, 10:36am, mmurphy replied:

What do you mean by “send”?

Modules have little to do with memory leaks. Modules are simply a way of organizing source code and have no runtime implications in ordinary apps. There may be runtime implications in scenarios like Instant Apps and Runtime Feature Modules, but I do not work with those and cannot comment on them.


At April 23, 2020, 11:13am, islam.farid2100 replied:

I mean by send view is to create and prepare a view with some data to represent and give to the other module so that the Activity of the other module display it as a part of the screen.


At April 23, 2020, 11:46am, mmurphy replied:

There’s nothing special about views here. You would send the view however you handle any other sort of object.

The fact that you do not want inter-module dependencies means that the receiver module will not have access to any types declared in the sending module. So, for example, the receiver module would need to take a View or ViewGroup instead of a SendingModuleAwesomeView or other custom class.

Overall, your question is very abstract, which limits me to fairly abstract answers. I apologize if you were hoping for more.