Print Android, Bluetooh

0

The outPutStream object gives me error,

  

W / System.err: java.lang.NullPointerException: Attempt to invoke   virtual method 'void java.io.OutputStream.close ()' on a null object   reference.

is when I try to send the data

try {
            mmOutputStream.write(msg.getBytes());
            bluetooth.setText("Data Sent");
        } catch (NullPointerException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    
asked by Ivan De Js Matrille 09.11.2018 в 03:23
source

1 answer

-1

The code you shared does not say anything. The line that is giving you problems is when you close the stream.

mmOutputStream.close();

The object is coming null. Something you are doing in the middle of the lines that you have shared and the line in which you close it. Check and if you can not paste all the code here.

    
answered by 09.11.2018 в 05:26