0

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?

user2638180
  • 1,013
  • 16
  • 37
  • Does this answer your question? [How can I run a method after return?](https://stackoverflow.com/questions/37299532/how-can-i-run-a-method-after-return) – Ankit Beniwal Oct 08 '20 at 08:29
  • @ankitbeniwal sorry, doesn't help me (even if I forget about the handler and execute the code). – user2638180 Oct 08 '20 at 08:46

0 Answers0