I'm new to java and would like to know how to do an activity run along with a service in the background. So that when the activity is closed and reopened it continues along with the service. I do not know how to explain it.
Suppose 3 services where each one is executed every hour.
Service 1... 1 hour ... Service 2 ... 1 hour ... Service 3. Finished.
And each time it is executed a textview is set visible in the activity. However when the activity is closed the textviews are not created.
The only way I found was by using variables as shown in the example below
Service 1:
public int service_one_done = 1;
Service 2:
public int service_two_done = 1;
Service 3:
public int service_three_done = 1;
Activity onCreate:
if (service_one_done == 1) { textview_example1.setVisibility(View.VISIBLE)
} if (service_two_done == 1) { textview_example2.setVisibility(View.VISIBLE)
} if (service_three_done == 1) { textview_example3.setVisibility(View.VISIBLE)
}
I would like to know if there is a better way to do this