Code example for BluetoothSocket

Methods: getInputStreamgetOutputStream

    private void connectStreams() throws BluetoothException { 
        try { 
            mOutStream = new BufferedWriter(new OutputStreamWriter(
            mInStream = new BufferedInputStream(mSocket.getInputStream());
            Log.i(TAG, "Socket stream to CAN translator opened successfully");
        } catch(IOException e) {
            Log.e(TAG, "Error opening streams ", e);
            mSocket = null;
            throw new BluetoothException(); 
    private void setAddress(String address) {
        // TODO verify this is a valid MAC address 
        mAddress = address;
Stop searching for code, let great code find you!  Add Codota to your java IDE