Last active
August 29, 2015 14:01
-
-
Save ueno-yuhei/167ccfb28e6ca22c4944 to your computer and use it in GitHub Desktop.
Bluetooth ON OFF 切り替え
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class BluetoothChanger{ | |
/** | |
* Bluetooth ON OFF | |
*/ | |
public static void setState(Context context,Boolean buletoothState){ | |
BluetoothAdapter mBtAdapter = BluetoothAdapter.getDefaultAdapter(); | |
if( !(mBtAdapter == null) ){ | |
if (buletoothState == true){ | |
mBtAdapter.enable(); | |
} else { | |
mBtAdapter.disable(); | |
} | |
}else{ | |
Toast.makeText(context,"お使いの端末はBluetoothをサポートしておりません。", 1000).show(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment