Java tutorial
//package com.java2s; //License from project: Apache License import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.content.Intent; import android.support.annotation.NonNull; public class Main { /** * Request code for bluetooth enabling */ public static final int REQUEST_CODE_BLUETOOTH_ENABLE = 0xb1e; /** * Enables bluetooth function.<br /> * the Activity may implement the `onActivityResult` method with the request code `REQUEST_CODE_BLUETOOTH_ENABLE`. * * @param activity the activity */ public static void enableBluetooth(@NonNull Activity activity) { activity.startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), REQUEST_CODE_BLUETOOTH_ENABLE); } }