E I
E I

Reputation: 533

The best way to implement showing "No Connection" message throughout the app

I'm developing the application-messenger and need to show dynamically "No Connection" message in case of lack of Internet, like in popular messengers (Viber, etc).

It should look like the narrow strip below the Action Bar or below the tabs. What is the best way to add such view dynamically? Is it custom SnackBar or PopupWindow?

enter image description here

Upvotes: 1

Views: 1019

Answers (1)

Peter Haddad
Peter Haddad

Reputation: 80944

You can use this:

compile 'com.androidadvance:topsnackbar:1.1.1'

then in the code add this example:

TSnackbar.make(findViewById(android.R.id.content),"no internet connection",TSnackbar.LENGTH_LONG).show();

This is the library for the above, it adds snackbars under toolbars:

https://github.com/AndreiD/TSnackBar

Upvotes: 3

Related Questions