Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.reflect.Method;
import android.bluetooth.BluetoothDevice;

import android.util.Log;

public class Main {
    private static final String TAG = "clsutils";

    static public boolean setPin(Class btClass, BluetoothDevice btDevice, String str) throws Exception {
        try {
            Method method = btClass.getDeclaredMethod("setPin", new Class[] { byte[].class });
            Boolean value = (Boolean) method.invoke(btDevice, new Object[] { str.getBytes() });
            Log.e(TAG, "" + value);
        } catch (Exception e) {
            // TODO: handle exception
            Log.e(TAG, "setPin error++");
            return false;
        }
        return true;
    }
}