0

I am using a handler onresume method which causes a sigbart error asking not to block ui threads. Here's the code I have:

 @Override
    public void onResume(){
        super.onResume();

        new Handler().postDelayed(() -> {

            try {

                refreshMypage();
            }catch (Exception e){
                e.printStackTrace();
            }
            convo.refreshMessage();
            presenter.refreshMessages();
        }, 2000);
    }

Here's the error :

A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 24971 (Thread-244)

How do I fix it such that it won't block the UI operations/thread and at the same time work as expected without crashes.

  • can you post the entire crash log and/or show more of what this code does – tyczj Feb 07 '18 at 17:54
  • I just get the sigbart error and no crash log. I posted the sigbart error above. –  Feb 07 '18 at 17:57
  • @tyczj is there a way to prevent it from blocking ui thread –  Feb 07 '18 at 17:58
  • A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 27666 (Thread-17) ] debuggerd: handling request: pid=27555 uid=10216 gid=10216 tid=27666 –  Feb 07 '18 at 18:00
  • Please post more of your code, more specifically what `refreshMyPage` and `refreshMessages` does – tyczj Feb 07 '18 at 18:14
  • `new Handler().postDelayed` will not automagically run your code in the background thread so if your `Runnable` is performing some long time operation it will block your UI thread – pskink Feb 07 '18 at 18:14

0 Answers0