【发布时间】:2012-01-30 23:49:59
【问题描述】:
我正在制作一个项目,我需要在其中显示主页,当主页显示时,之后或继续显示 3 到 5 秒我的另一个欢迎自定义对话框。但是这样做,会发生以下错误,但我的应用程序并没有停止工作.. LogCat 显示这些错误。 申请代码:
final Dialog d=new Dialog(Main.this);
d.setContentView(R.layout.SplashScreen);
Thread splashTread = new Thread() {
@Override
public void run() {
try {
d.show();
int waited = 0;
while(_active && (waited < _splashTime)) {
sleep(100);
if(_active) {
waited += 100;
}
}
} catch(InterruptedException e) {
// do nothing
} finally {
d.cancel();
stop();
}
}
};
splashTread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
_active = false;
}
return true;
}
LogCat 中的错误:
12-30 14:54:54.044: E/global(1232): Deprecated Thread methods are not supported.
12-30 14:54:54.044: E/global(1232): java.lang.UnsupportedOperationException.
12-30 14:54:54.044: E/global(1232): at java.lang.VMThread.stop(VMThread.java:85)
12-30 14:54:54.044: E/global(1232): at java.lang.Thread.stop(Thread.java:1280)
12-30 14:54:54.044: E/global(1232): at java.lang.Thread.stop(Thread.java:1247)
12-30 14:54:54.044: E/global(1232): at com.droidnova.android.SplashScreen$1.run(SplashScreen.java:35)
【问题讨论】:
标签: android