I am working on combining 2 projects into a single one. 1st project downloads a webpage and saves it. 2nd project is an AlarmManager project which is intended to run any command every hour. I want to incorporate the 1st project into the 2nd one, So it will download a webpage every hour.

Both the project works fine on their own. But I can't figure out how to group them together.

There are 2 separate classes, "MainActivity" and "MyAlarm". I have copied all the required functions from my 1st project into the "MainActivity" class. I want to call a function defined in "MainActivity" in the "MyAlarm" class because "MyAlarm" class has a method that is used to call other methods every hour.

I am not sure how to do this. Since I am a newbie in java development, any help would be greatly appreciated.


Edit:: Tried calling the method in MyAlarm using "MainActivity.FUNCTION_NAME" but it's not working. Screenshot

put on hold as too broad by gnat, Jörg W Mittag, BobDalgleish, Bart van Ingen Schenau, 8bittree 10 hours ago

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Hello, and welcome to Home Improvement. This may not be the best place for you to get help, as it sounds like you need some Java tutorials, rather than answers to specific questions. – Daniel Griscom Feb 9 at 19:30
  • I found a solution online. stackoverflow.com/questions/22241705/… This worked. – SKK Feb 10 at 23:28