TinyTask
TinyTask copied to clipboard
It doesn't Perform the job after fragment or activity resume.
I am in a AppDrawerNavigator Fragment. In my OnCreateView of the fragment I have a method LoadEmployeeJobs. This is the body of that method.
TinyTask.perform(new Something<List<Job>>() {
@Override
public List<Job> whichDoes() throws Exception {
return sj.getByTodayByEmployeeId(userLoggedInId);
// sj is a Retrofit service which is initalized in OnCreate of the fragment and Its not null
// when the problem occurs. That is I close and resume the app or go to another fragment
// and come back and I see no reloading of the jobs. I see in debugger it dont come in
// WhenDone but it do come in the LoadEmployeeJobs method.
}
}).whenDone(new DoThis<List<Job>>() {
@Override
public void ifOK(List<Job> jobs ) {
BusProvider.getInstance().post(new EmployeeJobsLoadedEvent(jobs));
}
@Override
public void ifNotOK(Exception e) {
Crouton.showText(getActivity(), "Problem loading employee jobs", Style.ALERT);
}
}).go();
Instead of Tiny Task I added an Async task default android and it works like a charm on every load.