Bluetooth, broken pipe exception when trying to send data with android

im not new to programming, but moderately new to java(not a fan) and brand new to android development(also not a fan). for testing right now im just trying to toggle a led on/off, but i get an exception thrown when it tries to send the data.

error: (i show which line the error is on in the java code) java.io.IOException: Broken pipe.
i printed out the socket as well previously and it was valid.

im using this

arduino: https://www.amazon.com/gp/product/B012FOV17O/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

bluetooth module: https://www.amazon.com/gp/product/B071YJG8DR/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

bluetooth module : arduino
RXD: RX1
TXD : TX0
GND : GND
VCC : VCC

arduino : other part of led/resistor
GND : led ground
2 : resistor : led positive

arduino code(taken from youtube as im trying to get this working asap before setting it up to do what i really want)

int LED_INPUT = 2;
void setup()
{
  Serial.begin(9600);
  pinMode(LED_INPUT,OUTPUT);
}

void loop() 
{
  char data;
  if(Serial.available())
  {
    data=Serial.read();
    if(data=='f')//LED ON
      digitalWrite(LED_INPUT,HIGH);
    if(data=='b')
      digitalWrite(LED_INPUT,LOW);
  }
}

java code

public class MainActivity extends AppCompatActivity {

    Button i1;
    TextView t1;

    String address = null , name=null;

    BluetoothAdapter myBluetooth = null;
    BluetoothSocket btSocket = null;
    Set<BluetoothDevice> pairedDevices;
    static final UUID myUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        try {setw();} catch (Exception e) {}
        SetupOnRun();
    }

    @SuppressLint("ClickableViewAccessibility")
    private void setw() throws IOException
    {
        t1=(TextView)findViewById(R.id.TBBluetooth);
        bluetooth_connect_device();

        i1=(Button)findViewById(R.id.BToggleLight);

        i1.setOnTouchListener(new View.OnTouchListener()
        {   @Override
        public boolean onTouch(View v, MotionEvent event){
            if(event.getAction() == MotionEvent.ACTION_DOWN) {led_on_off("f");}
            if(event.getAction() == MotionEvent.ACTION_UP){led_on_off("b");}
            return true;}
        });
    }

    private void bluetooth_connect_device() throws IOException
    {
        try
        {
            myBluetooth = BluetoothAdapter.getDefaultAdapter();
            address = myBluetooth.getAddress();
            pairedDevices = myBluetooth.getBondedDevices();
            if (pairedDevices.size()>0)
            {
                for(BluetoothDevice bt : pairedDevices)
                {
                    address=bt.getAddress().toString();name = bt.getName().toString();
                }
            }
        }
        catch(Exception we){t1.setText("first exception bluetooth_connected_device");}
        myBluetooth = BluetoothAdapter.getDefaultAdapter();//get the mobile bluetooth device
        BluetoothDevice dispositivo = myBluetooth.getRemoteDevice(address);//connects to the device's address and checks if it's available

        btSocket = dispositivo.createInsecureRfcommSocketToServiceRecord(myUUID);//create a RFCOMM (SPP) connection
        btSocket.connect();
        try { t1.setText("BT Name: "+name+"\nBT Address: "+address); }
        catch(Exception e){t1.setText("ISSUE bluetooth_connect_device");}
    }

    private void led_on_off(String i)
    {
        try
        {
            if (btSocket!=null)
                btSocket.getOutputStream().write(i.getBytes());//heres where it goofs
            t1.setText("Success led_on_off");
        }
        catch (Exception e)
        {
            t1.setText("ERROR led_on_off: " + e);//HERES THE EXCEPTION THAT GETS PRINTED OUT
        }
    }

    public void SetupOnRun()
    {
        SeekBar seekBar = (SeekBar) findViewById(R.id.SBSeekBar);
        TextView textBox = (TextView) findViewById(R.id.TBTest);
        ImageView bulb = (ImageView) findViewById(R.id.IMLightBulb);
        Button button = (Button) findViewById(R.id.BToggleLight);

        //seekBar.setForeground();
        int currentProgress = seekBar.getProgress();
        textBox.setText("Brightness: " + currentProgress + "%");
        bulb.setAlpha(currentProgress * 0.01f);
        button.setText("Off");

        SliderBarControl.StartSlider(seekBar, textBox, bulb, button);
    }

    public boolean IsButtonOn(Button button)
    {
        String buttonText = button.getText().toString();
        if (buttonText.equals("On"))
            return true;
        else
            return false;
    }

    public void TurnOffButton(Button button, SeekBar seekBar)
    {
        button.setText("Off");
        seekBar.setProgress(0);
    }

    public void TurnOnButton(Button button, SeekBar seekBar)
    {
        button.setText("On");
        seekBar.setProgress(seekBar.getMax());
    }

    public void ToggleButton(View v)
    {
        Button button = (Button) findViewById(R.id.BToggleLight);
        SeekBar seekBar = (SeekBar) findViewById(R.id.SBSeekBar);

        if (IsButtonOn(button)) {
            t1.setText("OFF TEST");
            led_on_off("b");
            TurnOffButton(button, seekBar);
        }
        else {
            t1.setText("ON TEST");
            led_on_off("f");
            TurnOnButton(button, seekBar);
        }
    }
}

if i missed some details let me know, i cant figure out where the issue is coming from

java(not a fan) and brand new to android development(also not a fan).......
setting it up to do what i really want)....
.......if i missed some details

This is an Arduino forum. I think, the bit you've missed is the bit that tells us what you really want to do with Arduino and plain-vanilla bluetooth. If you are not a fan of java, and not a fan of Android development, it seems that the only thing you want to do so far is bash your head against the wall, for no reward.

Nick_Pyner:
This is an Arduino forum. I think, the bit you've missed is the bit that tells us what you really want to do with Arduino and plain-vanilla bluetooth. If you are not a fan of java, and not a fan of Android development, it seems that the only thing you want to do so far is bash your head against the wall, for no reward.

from reading about the exception thrown ive gathered its more likely related to the arduino/bluetooth module being closed off from the connection ive made. i switch between multiple languages pretty often for different tasks, java is just the one i personally dont like working with as much as something such as c# for regular development. what im trying to do right now is just make it so i can toggle the led thats connected to the arduino on/off from my android phone. im just trying to get the communication between the arduino and my phone working before continuing the project.