Javateer
Javateer

Reputation: 65

How to apply the Splash Screen so that a black screen isn't initailly shown at app startup?

I am troubleshooting my deployment on Android (not yet tested on iOS also).

I have a simple SplashView class that just centers an image.

public class MySplashView extends SplashView {

public MySplashView(String nextView) {

    super(nextView);

    Image image = new Image(MySplashView.class.getResourceAsStream("/my_logo.jpg"));
    ImageView imageView = new ImageView(image);
    imageView.setFitWidth(AppManager.getInstance().getGlassPane().getWidth() * .75);
    imageView.setPreserveRatio(true);
    StackPane stackPane = new StackPane(imageView);

    super.setCenter(stackPane);
}

I've tried to declare this SplashView as soon as possible in the Application's workflow.

public class MyApplication extends Application {

@Override
public void init() {

    AppManager.getInstance().addViewFactory(SPLASH_VIEW, () -> new MySplashView("loginView"));
}

Before introducing this SplashView, the order I'd see at application start would be:

  1. Black Screen
  2. Login View

Now I see:

  1. Black Screen
  2. Splash View
  3. Login View

What more/else can I do so to stop showing the User an initial black screen?

Upvotes: 1

Views: 51

Answers (0)

Related Questions