Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.bluetooth.BluetoothAdapter;

public class Main {
    static private final String UNKNOWN = "UNKNOWN";

    static public String state2String(int state) {
        final String ON = "STATE_ON";
        final String OFF = "STATE_OFF";
        final String TURNING_ON = "STATE_TURNING_ON";
        final String TURNING_OFF = "STATE_TURNING_OFF";

        switch (state) {
        case BluetoothAdapter.STATE_ON:
            return ON;
        case BluetoothAdapter.STATE_OFF:
            return OFF;
        case BluetoothAdapter.STATE_TURNING_ON:
            return TURNING_ON;
        case BluetoothAdapter.STATE_TURNING_OFF:
            return TURNING_OFF;
        default:
            return UNKNOWN;
        }
    }
}