Android,LogCat显示此错误:"不支持弃用的线程方法",这是什么?

Hes*_*sam 2 multithreading android deprecated ddms

运行程序后,Logcat会显示一些错误(图片).但是在该程序运行并运行后没有问题.我无法理解问题出在哪里.

运行程序后,屏幕截图将显示5秒钟,然后显示该菜单(活动名称为Scroll_View).现在,LogCat显示错误.但是,当我点击每个按钮时,它可以正常工作,没有粗鲁或其他任何东西.

那很重要么?

这是线程的代码:

protected boolean _active = true;
    protected int _splashTime = 5000;
    @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.splash);

            // thread for displaying the SplashScreen
            Thread splashTread = new Thread() {
                @Override
                public void run() {
                    try {
                        int waited = 0;
                        while(_active && (waited < _splashTime)) {
                            sleep(100);
                            if(_active) {
                                waited += 100;
                            }
                        }
                    } catch(InterruptedException e) {
                        // do nothing
                    } finally {
                        finish();
                        startActivity(new Intent("mobilesoft.asia.malaysia_directory.SplashScreen.Scroll_View"));
                        stop();
                    }
                }
            };
            splashTread.start();
        }
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

ina*_*ruk 5

您会收到此异常,因为线程的方法stop()stop(Throwable)已过时,不应该被使用.

因为以这种方式停止线程是不安全的,并且可能使您的应用程序和VM处于不可预测的状态.