How to execute some code from a function after that function has returned a value in Android?

394 Views Asked by At

I'm trying to execute some code defined in a function after that function has executed a return instruction.

I'm trying to do it this way:

Handler handler=new Handler();

handler.postDelayed(new Runnable() {
      @Override
      public void run() {
                                
      },20000);

return value;

Granted, this could be easily solved by calling that handler after the value has been returned in the function that calls it, but we want to put the logic in a library so the user does not have to work with that code that executes aftewards (although if this is not possible to do we will have to include a call to that code that needs to be executed with delay).

Is there any way to do what I'm asking to?

0

There are 0 best solutions below