I have defined a function in MainActivity now I want to access the function from another class in my app. I have created an object of the MainActivity and with that object I have called the function. Although there is no error, it’s not executing. Every time I try to execute, the app crashes.
I have defined a function in MainActivity now I want to access the function
Share
Activity A should have a variable
In onCreate state:
and add this method:
In activity B, call