I am kinda new to java and android studio and I tryed to add a splashscreen to my app, but the problem is that animated drawables - splaschscreens are not supported by older versions of android, so I wanted to hide it for lower versions. I have made an if- condtion to hide it, however it keeps on showing anyways and crashes the app after it. Is there a possibility to fix it?
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
SplashScreen.installSplashScreen(this);
try {
sleep(550);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
setContentView(R.layout.activity_main);
}
}
p.s sorry for my english