SplashScreen不会转到主应用程序(ANDROID)

SplashScreen不会转到主应用程序(ANDROID),android,Android,可能重复: 我的喷溅屏静止不动。它不允许主应用程序在之后运行。下面是我正在使用的代码:我有三个文件:Splash.xml、Splash.java和SplashNew.java package com.timchecklist; import android.app.Activity; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; public clas

可能重复:

我的喷溅屏静止不动。它不允许主应用程序在之后运行。下面是我正在使用的代码:我有三个文件:Splash.xml、Splash.java和SplashNew.java

     package com.timchecklist;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;

public class Splash extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Thread Timer = new Thread() {
            public void run() {

                try {
                    sleep(3000);
                    startActivity(new Intent("com.timchecklist.SPLASHNEW"));

                } catch (InterruptedException e) {
                    e.printStackTrace();
                } finally {
                    finish();
                }
            }
        };
        Timer.start();
    }

}
   package com.timchecklist;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;

public class SplashNew extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.splash);

    }

}
SplashNew.java

     package com.timchecklist;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;

public class Splash extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Thread Timer = new Thread() {
            public void run() {

                try {
                    sleep(3000);
                    startActivity(new Intent("com.timchecklist.SPLASHNEW"));

                } catch (InterruptedException e) {
                    e.printStackTrace();
                } finally {
                    finish();
                }
            }
        };
        Timer.start();
    }

}
   package com.timchecklist;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;

public class SplashNew extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.splash);

    }

}
Splash.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:background="@drawable/pic1"
    android:gravity="center"
    android:orientation="vertical" >

</LinearLayout>

AndroidManifest.xml

  <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.timchecklist"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="7" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".TimCheckListActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.NoTitleBar" >
        </activity>
        <activity
            android:name=".SplashNew"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

AndroidManifest.xml
有什么想法/帮助吗


Ty guys

请更改
startActivity(新意图(“com.timchecklist.SPLASHNEW”)
开始触觉(新意图(SplashNew.class))

如果您在此期间没有任何工作要做,请不要让您的用户等待启动屏幕3秒钟。如果您的应用程序需要做一些工作,则在后台显示启动屏幕时进行这些工作。如果你强迫你的用户在使用你的应用程序时无缘无故地等待3秒钟,他们会不高兴

下面是一个很好的示例,其中有一个实现它们的方法

但是我非常严肃地强调,如果你没有充分的理由让用户等待,那么就不要让他们等待


编辑:如果你坚持让你的用户等待一个毫无意义的启动屏幕,至少要实施一些方法来检查用户在启动过程中是否后退(退出了你的应用程序),以及他们是否没有调用startActivity()。按照您现在的方式,即使用户在启动过程中按back(如果您让他们无故等待3秒钟,他们也会这样做)。您的线程仍将调用startActivity(),这将使您的活动位于顶部,即使用户通过按back按钮退出。上面的链接谈到了这一点。

这不是问题所在。问题是它不会转到main。新的是main?您不能在途中前往SplashNew,因为“com.timchecklist.SplashNew”不存在。我已经忘记了如何创造这条捷径,但我更喜欢这种方式。只需测试它,没有main是:TimCheckListActivity.java