Java tutorial
//package com.java2s; import android.bluetooth.BluetoothAdapter; public class Main { private static void setBluetooth(int btVal) { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (btVal == 0 && !bluetoothAdapter.isEnabled()) { bluetoothAdapter.enable(); } else if (btVal == 1 && bluetoothAdapter.isEnabled()) { bluetoothAdapter.disable(); } } }