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

倾然丶 夕夏残阳落幕 提交于 2019-12-13 12:24:38

问题


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);


来源:https://stackoverflow.com/questions/22803476/animators-may-only-be-run-on-looper-threads-on-sherlock-action-bar

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