I am having trouble with this splash screen. The first one should last 3 seconds then go to the second splash, but all that is happening is the first opens up then nothing else happens any ideas?
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash1 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash1);
}
final Thread logoTimer = new Thread() {
public void run() {
try {
sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
Intent splash2 = new Intent("com.zombieface.dubsnake.SPLASH2");
startActivity(splash2);
}
}
};
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
finish();
}
}
This is the Manifest:
<activity
android:name=".Splash1"
android:configChanges="keyboard|keyboardHidden|orientation"
android:label="Dub Snake"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Splash2"
android:configChanges="keyboard|keyboardHidden|orientation"
android:label="Dub Snake"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="com.zombieface.dubsnake.SPLASH2" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
If that is all your code then you forgot to actually start the thread
logoTimerso you never get in that loop and start the new activity.From your
onCreate()call: