我正在开发一个将 minSdkVersion=10 用于姜饼的应用程序。它在所有姜饼设备上运行良好,但是当我尝试在 4.0.3 模拟器(ICS)上运行它时,它总是停止。我需要调整什么设置吗?
这是我的清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.das"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="15" />
logcat 上的错误是这样的
02-22 15:03:40.217: E/global(514): Deprecated Thread methods are not supported.
02-22 15:03:40.217: E/global(514): java.lang.UnsupportedOperationException
02-22 15:03:40.217: E/global(514): at java.lang.VMThread.stop(VMThread.java:85)
02-22 15:03:40.217: E/global(514): at java.lang.Thread.stop(Thread.java:1280)
02-22 15:03:40.217: E/global(514): at java.lang.Thread.stop(Thread.java:1247)
02-22 15:03:40.217: E/global(514): at com.example.SpelloGrande.splash$1.run(splash.java:48)
飞溅活动
public class splash extends Activity {
//how long until we go to the next activity
protected int _splashTime = 3000;
private Thread splashTread;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
final splash sPlashScreen = this;
// thread for displaying the SplashScreen
splashTread = new Thread() {
@Override
public void run() {
try {
synchronized(this){
//duration
wait(_splashTime);
}
} catch(InterruptedException e) {}
finally {
finish();
//start a new activity
Intent i = new Intent();
i.setClass(sPlashScreen, MainActivity.class);
startActivity(i);
stop();
}
}
};
splashTread.start();
}
//Function that will handle the touch
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
synchronized(splashTread){
splashTread.notifyAll();
}
}
return true;
}
}