Android不支持的线程
问题描述:
我得到这个错误在Android 4.0 +,也许3.0 +用户。不是2.3以下的用户 我能做些什么来解决这个问题?希望在快速anwser,用户抱怨:(Android不支持的线程
java.lang.UnsupportedOperationException at java.lang.Thread.stop(Thread.java:1076) at java.lang.Thread.stop(Thread.java:1063) at application.application.Splash$1.run(Splash.java:51)
static int destroy = 0;
保护布尔_active = TRUE; 保护INT _splashTime = 5000;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
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("app.app.TABHOST"));
stop();
}
}
};
splashTread.start();
}
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
_active = false;
}
return true;
}
}
如果你能出示了一下你的代码,你所得到的例外..我可以试着帮你.. – 5hssba 2012-04-17 19:04:52
代码添加到describtion – Ukjent 2012-04-17 19:09:28