Package Org. example. itester; import android. app. activity; import android. bluetooth. export thadapter; import android. content. context; import android. content. intent; import android.net. wiFi. wifiinfo; import android.net. wiFi. wifimanager; import android. OS. bundle; import android. widget. textview; public class wifibtcheck extends itester {Private Static final int request_enable_bt = 3; @ override public void oncreat E (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. wifibtcheck); mwifi = (wifimanager) getsystemservice (context. wifi_service); If (! Mwifi. iswifienabled () {mwifi. setwifienabled (true);} wifiinfo = mwifi. getconnectioninfo (); badapt = descrithadapter. getdefaadapter adapter (); If (badapt! = NULL) {If (! Badapt. isenabled () {intent enbt = new intent (effecthadapter. action_request_enable); startactivityforresult (enbt, request_enable_bt);} btmac = badapt. getaddress ();} else {btmac = "no Bluetooth device! ";} If (wifimac = wifiinfo. getmacaddress () = NULL) {wifimac = "no wifi device";} textview MAC = (textview) findviewbyid (R. id. macview); Mac. settextsize (38); Mac. settext ("wireless MAC:" + wifimac + "\ n Bluetooth Mac:" + btmac);} public void onactivityresult (INT requestcode, int resultcode, intent data) {Switch (requestcode) {Case request_enable_bt: // when the request to enable Bluetooth returns if (resultcode = activity. result_ OK) {// Bluetooth is now enabled, so set up a chat session} else {finish ();}}}}