0

I have a JavascriptInterface that calls a function to draw in a layout. This function needs to be run on the UI Thread. I don't know why, but it is always called twice, making my app fail. Can someone help me?

@JavascriptInterface
        public void cambiarIdioma(String idIdioma)
        {
            runOnUiThread(new Runnable()
            {
                @Override
                public void run()
                {
                    setupTabLayout(Integer.parseInt(idIdioma),false);
                }
            });
        }
  • can you check if you app is going in onPause state and then again calling onResume? – Java Nerd Mar 08 '22 at 10:16
  • I put a Log.i in both onResume and onPause and it seems it only print the onResume one once at the beggining of the execution. onPause one is not printed. – daniveler Mar 08 '22 at 10:23
  • then double check if your app is crashing and you are unable watch any exception! – Java Nerd Mar 08 '22 at 10:26
  • The app doesn't crash, but calling the function twice makes the function not work properly. Also, I don't see any error message in the logcat. – daniveler Mar 08 '22 at 10:33

0 Answers0