Example usage for android.bluetooth BluetoothAdapter getClass

List of usage examples for android.bluetooth BluetoothAdapter getClass

Introduction

In this page you can find the example usage for android.bluetooth BluetoothAdapter getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.github.akinaru.hcidebugger.activity.HciDebuggerActivity.java

/**
 * Activate/Desactivate snoop file log/*  w ww.j av a2s  .c  o m*/
 *
 * @param state true if snoop file log is activated, false elsewhere
 */
public void configSnoopFile(boolean state) {
    BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
    Method[] adapterMethods = adapter.getClass().getDeclaredMethods();
    for (Method method : adapterMethods) {
        if (method.getName().equals("configHciSnoopLog")) {
            Log.v(TAG, "activating snoop file log");
            try {
                boolean ret = (boolean) method.invoke(adapter, state);
                Log.v(TAG, "configSnoop return with state " + ret);
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            }
        }
    }
}