Wednesday, November 22, 2017

Checking internet connection and showing result in Snackbar in android studio

Using Snackbar you need to add android support design dependencies. Copy below dependencies and add to your build.gradle file.


compile 'com.android.support:design:25.3.1'

Give an id to your layout. as I am using RelativeLayout so I give it an id like 'mylayout'

android:id="@+id/mylayout"

In MainActivity.java file inside onCreate() method added your layout id like

Recent Post