AIDE Tutorial - 53 Change WiFi State
Watch the Video Below:
Main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:id="@+id/mainButtonOn"
android:text="Turn On Wifi" android:layout_width="wrap_content" android:layout_height="wrap_content" />
android:id="@+id/mainButtonOff"
android:text="Turn Off Wifi" android:layout_width="wrap_content" android:layout_height="wrap_content" />
package com.kcgroup.CWS;
import android.os.*;
import android.widget.*;
import android.view.View.*;
import android.view.*;
import android.net.wifi.*;
import android.content.*;
{
@Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnOn.setOnClickListener(new View.OnClickListener(){
public void onClick(View p1)
{WifiManager wifi=(WifiManager)getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(true);Toast.makeText(getApplicationContext(),"WiFi is turned ON",Toast.LENGTH_SHORT).show();}});
Button btnOff=(Button)findViewById(R.id.mainButtonOff);
btnOff.setOnClickListener(new View.OnClickListener(){
public void onClick(View p1)
{WifiManager wifi=(WifiManager)getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(false);Toast.makeText(getApplicationContext(),"WiFi is turned OFF",Toast.LENGTH_SHORT).show();}}); }}
uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
2. Aide Tutorial - 20.1 Webview with ProgressBar
3. Aide tutorial - 20.2 webview with back button
4. Aide tutorial - 20.3 webview with exit button