I have task in my app, and i do not know how it works return from this task.
public class TimeManager extends Service<String> {
@Override
protected Task<String> createTask() {
return new Task<String>() {
@Override
protected String call() throws Exception {
String txt = null;
while (!isCancelled()) {
try {
txt = "some txt";
Thread.sleep(1000);
} catch (InterruptedException e) {
System.out.println(e.getMessage());
}
}
return txt;
}
};
}
And in Main Class:
TimeManager time = new TimeManager();
time.start();
time.getValue();
time allways return null. What do I have to do to return the value? Thread works good and I can send data from the thread to the application