我目前在市场上有一个简单的应用程序,现在我尝试在 Android 4.0 设备上安装它。 但是在我的 Splashscreen 关闭后它失败了。我发送了一个融洽的关系并得到了这个作为反馈:
Crash
java.lang.UnsupportedOperationException
Thread.stop()
和
java.lang.UnsupportedOperationException
at java.lang.Thread.stop(Thread.java:1076)
at java.lang.Thread.stop(Thread.java:1063)
at com.lars.PSVWebView.SplashScreen$1.run(SplashScreen.java:35)
这是自上次编辑以来的代码:
package com.lars.DrinkRecOrder;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class SplashScreen extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
Intent intent = new Intent();
intent.setClass(SplashScreen.this, DrinkRecOrderActivity.class);
}{
/* start the activity */
startActivity(new Intent("com.lars.DrinkRecorder.splashscreen.DrinkRecorderActivity"));
}
}, 500);
}
}
所以这是我的新代码...没有错误,但也不起作用,我的应用程序在启动时崩溃。 顺便说一句...相同的启动画面代码,不同的应用程序
最佳答案
你可以使用这个方法:
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
Intent intent = new Intent();
intent.setClass(SplashScreen.this, NextActivity.class);
}
/* start the activity */
startActivity(intent);
}
}, SPLASH_SCREEN_TIME_IN_MILLISECONDS);
我认为它比 Thread.sleep()
更好更优雅
关于android - 我的应用程序 Splashscreen 在 android 4.0 Ice Cream Sandwich 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9142788/