Bluetooth State

Example:

                                    
                                        <!-- AndroidManifest.xml -->
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

<!-- activity_main.xml -->
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:padding="16dp">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true">

        <TextView
            android:id="@+id/bluetoothStatus"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Bluetooth Status"
            android:textStyle="bold"
            android:textSize="20sp"
            android:textColor="#000000"
            android:gravity="center"
            android:layout_marginTop="20dp"
            android:layout_marginBottom="6dp"/>

        <Switch
            android:id="@+id/bluetooth_switch"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/bluetoothStatus"
            android:layout_centerInParent="true"
            android:text="Switch ON/OFF"
            android:layout_marginTop="20dp"/>
    </RelativeLayout>

</RelativeLayout>