I've created a splash screen, and it works pretty fine at first, but after that, it shows me a white blank screen instead of my splash screen image file. I've no idea why that happens.
I tried to change my style.xml parent theme, but some of the themes crash my app, and only Theme.AppCompat.Light.NoActionBar works and gives me a blank white screen.
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
Splash.java
public class Splash extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Thread ssThread = new Thread(){
@Override
public void run() {
try {
sleep(3000);
Intent startMainScreen = new Intent(getApplicationContext(),MainActivity.class);
startActivity(startMainScreen);
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
ssThread.start();
}
}
Screen sequence, thread sleep time, and everything else works fine except that the image is not showing.
In your onCreate method, you forgot to add setContentView(R.layout.splash);