android - 我的应用程序 Splashscreen 在 android 4.0 Ice Cream Sandwich 上失败

标签 android crash splash-screen android-4.0-ice-cream-sandwich

我目前在市场上有一个简单的应用程序,现在我尝试在 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/

相关文章:

Android:在 TextView 上画线

android - 如何在呈现 SplashScreen 期间运行 MainActivity

ios - 如何以编程方式创建启动屏幕功能?

java - 上下文为null,转移到API 27后突然获得NPE

iphone - 我的应用程序在我的 Iphone 上启动时崩溃

ios - 快速错误线程 1 : EXC_BAD_INSTRUCITON

iphone - 在 iOS 应用程序的 XCode 6.1 中设置 Launchimage 时出现错误

android - UnknownFormatConversionException : Android strings. xml 格式 <![CDATA[ ...%1$... ]]>

android - 如何在三种模式下更改按钮文字样式?

android - 没有多重效果的 Imageview 触摸/点击效果 (Android)