2

I just want to ask how can I get /call / transfer data from main app to module app in android studio Kotlin? I have 2 modules project inside of my main project

example: main [App] then Module [Chatapp]

I just want to call class or fragment activity on main project to moudule project chatapp. I can only call it in my module now, not in my main project app

I've search on Google but nothing found.

Rafa Guillermo
  • 14,474
  • 3
  • 18
  • 54
  • 1
    Your chat module should depend on main module if you want to call some code from it put this in chat **build.gradle** `implementation project(':YouMainModule')` – Mohammed Alaa Dec 23 '19 at 09:25
  • i do this but they have some error – Marvenn Suson Dec 23 '19 at 09:49
  • you can post your error logs, so we can help – Mohammed Alaa Dec 23 '19 at 09:55
  • Use an interface in the module as a caller contract when the module is used in main module. Then you can call the contract to call the main module. – ישו אוהב אותך Dec 23 '19 at 12:56
  • I'll add up to ישו אוהב אותך's comment. I suspect that you risk ending up with circular dependencies. So I would suggest you to implement it as a callback or still something along the lines of the publish subscribe pattern. BTW With a functional programming language callback can be much less verbose, but they do need a lot of comments. – FluidCode Dec 31 '19 at 13:18

0 Answers0