Home > Enterprise >  Android - Can I call a function of the app in the module?
Android - Can I call a function of the app in the module?

Time:03-10

First : app called Module's Activity Second : Module want to Call app's Method

Example:)

  • app have [public int sum(int a, int b)] method in com.example.myapplication.calcurate
  • module Needs call sum(1,2) and return 3

CodePudding user response:

For your module to recognize your app (also a module). yo need the add this line in your dependencies (in your module gradle):

implementation project(':app')

After adding this line your module will be able to use your public class from 'app module'

Or

you can make your 'com.example.myapplication.calcurate' as library and then add the arr file to your module and use it

  • Related