运行程序后,Logcat 显示一些错误(图片)。 但是在该程序运行并正常工作之后。我不明白问题出在哪里。
运行程序后,屏幕截图将显示 5 秒,然后显示菜单( Activity 名称为 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();
}
最佳答案
您收到此异常是因为 Thread 的方法 stop()
和 stop(Throwable)
已弃用,切勿使用。
Because stopping a thread in this manner is unsafe and can leave your application and the VM in an unpredictable state.
关于Android,LogCat 显示此错误 : "Deprecated Thread methodes are not supported", 这是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6831580/