Internet availability check for any standard application is necessary. When you call an Rest API or any internet related task execution, you must need to check the internet availability in your application. So In this article, I show you how to check the internet availability in android | Kotlin So, First in your project add the INTERNET and ACCESS_NETWORK_STATE permission in menifest.xml <uses-permission android:name= "android.permission.INTERNET" /> <uses-permission android:name= "android.permission.ACCESS_NETWORK_STATE" /> Make a function in kotlin, that return true if internet connection is available else it return false fun isOnline (context: Context): Boolean { val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val activeNetwork: NetworkInfo? = cm.activeNetworkInfo return activeNetwork?.isConnectedOrConnecting == true } Now, simply you c...
In every single android application, we need to make many number of recycler-view adapter. So every time you create a blank adapter and modify it as per your requirements. But it is very boring and as well as time taking. So here I give you a solution that you can create any recyclerview adapter within 5 seconds using file template in Android Studio. So, Lets read this full article- First we open android studio and create a project. After project creation Open File->new->Edit File Template... Follow this below screenshot Okay, After click on "Edit File Template" a popup is open "File and Code Template", Now click on the " + " icon and set set your template name. Now set your template name, template extension and template body. after doing everything click on "Apply" and then click on "OK" The template body I after after the screenshot Template Body Copy this code and paste it on the template body section, which I marked in scre...