Alexey
Alexey

Reputation: 3202

snackbar without content view

I make a splash screen without any content view (just with logo image as theme background), which shown till app initialization done.

If an error occurs during initialization I'd like to notify user by snackbar. Is there a way to show snackbar without inflating content view?

I tried to pass getWindow().getDecorView() as view argument to Snackbar.make(), but nothing happened.

Upvotes: 3

Views: 2938

Answers (1)

LoveForDroid
LoveForDroid

Reputation: 1142

You should be passing getWindow().getDecorView().getRootView():

Snackbar.make(getWindow().getDecorView().getRootView(), "Some error occured", Snackbar.LENGTH_LONG).show();

Upvotes: 6

Related Questions