Animators may only be run on Looper threads on Sherlock Action Bar

匿名 (未验证) 提交于 2019-12-03 08:35:02

问题:

I wanted to hide the action bar after the 1 second delay,

Timer().schedule(new TimerTask() {                         @Override                         public void run() {                                 getSupportActionBar().hide();                         }                     }, 1000); 

Getting crash after I ran the code..

android.util.AndroidRuntimeException: Animators may only be run on Looper threads

Is there any solution for this issue? Thanks.

回答1:

Solved it by using

new Handler().postDelayed(new Runnable() {                         @Override                         public void run() {                                 getSupportActionBar().hide();                         }                     }, 1000); 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!