no internet connection dialog

In this post you will learn about how to show No Internet Connection Dialog. It is very pretty simple though. Showing No Internet Connection Dialog is very helpful in app like WebView app and all other apps which are mainly dependent on Internet to work. Making this is very easy and just take few minutes. Output will be as below screenshot.

no_internet_connection_Dialog

Procedure:

First you need to add below permission to your manifest file.

Next go to your MainActivity.Java and below methods below onCreate Method.

You may get many errors here click on the error text and press Alt+Enter on your keyboard. Repeat the step for all error text like this.

Next replace below line of code in MainActivity.Java

with below code

Now run the code on your phone with Mobile data and WiFi connection turned off to see the desired output i.e, No Internet connection Dialog when there is no internet connection on your Android Device.