Enable And Disable Wi-Fi In Android Application Using toggle button

Hello Guys. Welcome to our new tutorial of Enable And Disable Wi-Fi In Android Application Using toggle button. enable or disable wifi by clicking the toggle button.

please follow the code given below to turn on and off wifi using toggle button.

  • 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 looks like.

Enable And Disable Wi-Fi In Android Application Using toggle button Enable And Disable Wi-Fi In Android Application Using toggle button Enable And Disable Wi-Fi In Android Application Using toggle button

 

Leave a Reply

Your email address will not be published. Required fields are marked *