When my splash screen starts i get tis error in logcat:
11-06 02:36:45.450: E/global(4184): Deprecated Thread methods are not supported.
11-06 02:36:45.450: E/global(4184): java.lang.UnsupportedOperationException
11-06 02:36:45.450: E/global(4184): at java.lang.VMThread.stop(VMThread.java:85)
11-06 02:36:45.450: E/global(4184): at java.lang.Thread.stop(Thread.java:1280)
11-06 02:36:45.450: E/global(4184): at java.lang.Thread.stop(Thread.java:1247)
11-06 02:36:45.450: E/global(4184): at com.example.kostas.splash$1.run(splash.java:38)
this is my class:
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("com.example.kostas.main"));
stop();
}
}
};
splashTread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
_active = false;
}
return true;
}
line 38 is stop();
My app starts with no problem but i would like to fix it..i tried to delete “stop();” but i m getting another error too..
11-06 02:44:56.321: E/(32599): onResume() check 0
11-06 02:44:56.321: E/(32599): onResume() check 1
11-06 02:44:56.321: E/Launcher(32599): setWindowOpaque()
11-06 02:44:56.341: E/(32599): onResume() check 2, mRestoring : false
11-06 02:44:56.341: E/(32599): onResume() check 3
11-06 02:44:56.341: E/(32599): onResume() check 4
11-06 02:44:56.345: E/(32599): onResume() check 5
thanks
The answer is in the error message: Thread.stop() is deprecated, and Android does not support deprecated methods.
Perhaps you can try using Thread.sleep() in your onCreate to do the timeout instead.