Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sachitmuckaden committed Mar 26, 2012
1 parent 29f28be commit fefad0f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/com/netswitch/NetSwitchActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,16 @@ public void onCreate(Bundle savedInstanceState)
public void onClick(View v)
{
Context mContext = getApplicationContext();
WifiManager mWifi = (WifiManager)mContext.getSystemService(Context.WIFI_SERVICE);
mWifi.setWifiEnabled(true);
WifiSwitchUtil wifi = new WifiSwitchUtil();
boolean currentstate;
try{
currentstate = wifi.getWifiState(mContext);
}
catch (NullPointerException e)//If WIFI state doesn't return a value, sets the WIFI state to true
{
currentstate = false;
}
wifi.changeWifiState(!currentstate, mContext);

}
});
Expand Down

0 comments on commit fefad0f

Please sign in to comment.