First you can run MainActivity and run SplashActivity in onCreate() MainActivity . After the required duration, you can simply close SplashActivity and MainActivity again so that it looks like you started Main from Splash.
Let me explain this -
In MainActiviy use intent and run SplashActivity using startActivity , not startActivityForResult , since you don't want to pass the result from SplashActivity to MainActivity .
Now that you are in SplashActivity , start the stream and wait in the stream for the desired duration, and then call finish() so that SplashActivity closes and the previously launched MainActivity appears in the foreground.
Hope this helps.
user1721904
source share