I have executing method (for example JNI.calculate(listener))of JNI library. It should takes for example 30 seconds. I wanted but executing this method calculate(listener) again but first I need to stop last executing. This method has one parameter - listener, that has two methods:
public void canContinue(){
return canContinue;
}
public void result(int number){
//some code
}
The method canContinue calls asynchronous, for example every 3 seconds. I just dont want to wait, until next canContinue will be called. I wanted to immediatelly execute next execution of this method calculate(listener).
Do you have any recommendations? Probably I should use Handler, HandlerThread, Thread, AsyncTask or som sort of this classes, but how to figure it out?