Java tutorial
//package com.java2s; import java.lang.reflect.Method; import android.bluetooth.BluetoothDevice; public class Main { @SuppressWarnings({ "rawtypes", "unchecked" }) public static boolean createBond(BluetoothDevice btDevice) throws Exception { Class class1 = Class.forName("android.bluetooth.BluetoothDevice"); Method createBondMethod = class1.getMethod("createBond"); Boolean returnValue = (Boolean) createBondMethod.invoke(btDevice); return returnValue.booleanValue(); } }