我的应用程序启动画面在 android 4.0 冰淇淋三明治上失败

发布于 2025-01-02 15:37:36 字数 1366 浏览 2 评论 0原文

我目前在市场上有一个简单的应用程序,现在我尝试将其安装在 Android 4.0 设备上。 但在我的闪屏关闭后它失败了。我发送了一份融洽关系并得到了反馈:

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);

    }
}

所以这是我的新代码...没有错误,但也不起作用,我的应用程序在启动时崩溃。 顺便说一句...相同的启动屏幕代码,不同的应用程序

I currently have a simple app in the market, now I tried installing it on an Android 4.0 device.
But it fails after my Splashscreen closes. I send a rapport and got this as feedback:

Crash
java.lang.UnsupportedOperationException
Thread.stop()

and

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)

this is the code, since last edit:

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);

    }
}

So this is my new code... no errors, but doesn't work either, my app crashes at startup.
By the way... same splashscreen code, different app

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

呆橘 2025-01-09 15:37:36

你可以使用这个方法:

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() 更好、更优雅。

You can use this method:

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);

I think it's far better and elegant than Thread.sleep()

执笏见 2025-01-09 15:37:36

阅读文档<代码>Thread.stop()。

此方法已被弃用。
因为以这种方式停止线程是不安全的,并且可能会使您的应用程序和虚拟机处于不可预测的状态。

抛出UnsupportedOperationException

Read the documentation on Thread.stop().

This method is deprecated.
because stopping a thread in this manner is unsafe and can leave your application and the VM in an unpredictable state.

Throws UnsupportedOperationException.

套路撩心 2025-01-09 15:37:36

这就是答案!

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() {

                /* start the activity */
                startActivity(new Intent("com.lars.DrinkRecOrder.splashscreen.DrinkRecOrderActivity"));
            }
        }, 5000);

    }
}

This was the answer!

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() {

                /* start the activity */
                startActivity(new Intent("com.lars.DrinkRecOrder.splashscreen.DrinkRecOrderActivity"));
            }
        }, 5000);

    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文