में थ्रेड रिटर्न त्रुटि मेरे पास एक सवाल है कि मेरे एंड्रॉइड ऐप में स्प्लैश स्क्रीन है जिसमें मैं 8 सेकंड के लिए थ्रेड का उपयोग कर रहा हूं, यह 1.6,2.1,2.2,2.3 में ठीक चल रहा है .3, 3.0, 3.1 लेकिन जब मैं एंड्रॉइड के 4.0.3 संस्करण में इसे चलाने के लिए त्रुटि चाहता हूं, तो मुझे त्रुटि मिलती है, मुझे नहीं पता क्यों? कृपया मुझे इसके लिए सही समाधान सुझाएं। नीचे मैंने त्रुटि स्टैक और मेरा कोड भी बताया।एंड्रॉइड 4.0.3 संस्करण
त्रुटि ढेर:
01-05 10:16:06.417: E/AndroidRuntime(589): FATAL EXCEPTION: Thread-75
01-05 10:16:06.417: E/AndroidRuntime(589): java.lang.UnsupportedOperationException
01-05 10:16:06.417: E/AndroidRuntime(589): at java.lang.Thread.stop(Thread.java:1076)
01-05 10:16:06.417: E/AndroidRuntime(589): at java.lang.Thread.stop(Thread.java:1063)
01-05 10:16:06.417: E/AndroidRuntime(589): at com.shipface.common.SplashScreen$1.run(SplashScreen.java:34)
कोड:
public class SplashScreen extends Activity {
/** Called when the activity is first created. */
Thread splash;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
splash = new Thread(){
@Override
public void run(){
try {
synchronized(this){
// Wait given period of time or exit on touch
wait(4000);
Intent intent = new Intent(SplashScreen.this,HomeActivity.class);
startActivity(intent);
finish();
}
}
catch(InterruptedException ex){
}
finish();
stop();
}
};
splash.start();
}
}