Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.support.annotation.Nullable;

public class Main {
    @Nullable
    public static BluetoothDevice getDevice(String address) {
        if (!hasBluetoothAdapter())
            return null;
        return getBluetoothAdapter().getRemoteDevice(address);
    }

    public static boolean hasBluetoothAdapter() {
        return BluetoothAdapter.getDefaultAdapter() != null;
    }

    @Nullable
    public static BluetoothAdapter getBluetoothAdapter() {
        return BluetoothAdapter.getDefaultAdapter();
    }
}