enable disable wifi android studio source code
in this article, you will learn how to enable disable wifi using android studio. also, I will provide you source code using this code you can create this application.using android.net.wifi.WifiManager class you can manage the wifi connectivity. This example demonstrates about How to enable disable wifi using android studio.
- First Create a new project in Android Studio
- File ⇒ New Android ⇒ Application Project
- Then Open src -> package -> MainActivity.java and then add following code :
JAVA (MainActivity.java)
- Now Open res -> layout -> activity_main.xml and then add following code :
XML (activity_main.xml)
Output:
Finally, run this project.
This is how your application look like.