display.clearDisplay();

Hi All, I am new to arduino coding and have been struggling with this "learner" project of mine. I have put together this code below and was wondering if anyone could shed light with my struggle with "display.clearDisplay();". All I am doing is whenever I press a button state "LOW" my OLED display will display "OFF" and whenever I press "HIGH" it will display "ON". "ON" and "OFF" are dynamic but in my code there is a string "TITLE HEADER" which is static. Problem is, I have been struggling where to put "display.clearDisplay();" with out one affecting the other specially the title header. I solved the ON and OFF from blinking but then my static title blinks. been pulling my hair out and greatly appreciate some help. cheers

#include <Adafruit_SH1106.h>
#include <Wire.h>
#include <SPI.h>
//#include <Adafruit_GFX.h>
#define OLED_RESET 4
Adafruit_SH1106 display(OLED_RESET);

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

int LEDPin=11;
int buttonPin=6;
int buttonRead;
int dt=100;

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);

pinMode(LEDPin, OUTPUT);
pinMode(buttonPin,INPUT);

display.begin(SH1106_SWITCHCAPVCC, 0x3C);

}

void loop() {
// put your main code here, to run repeatedly:

buttonRead=digitalRead(buttonPin);
Serial.println(buttonRead);
delay(dt);

display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("TITLE HEADER");
display.display();

if (buttonRead==1){
digitalWrite(LEDPin,LOW);

display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(50, 30);
display.println("OFF");
display.display();

}

if (buttonRead==0){
digitalWrite(LEDPin,HIGH);

display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(50, 30);
display.println("ON");
display.display();

}
//display.clearDisplay();
}

Your post was MOVED to a more suitable location.

Could you also review How to get the best out of this forum as it will help you find your way around.

Please use "code tags", </>, when posting code.
A wiring diagram for the button would be good.
"pinMode(buttonPin,INPUT);". Is there a pullup up or pull down resistor and to what is the other side of the button connected?

Don't clear the display.

First just write the new text over the old, if that results in a mess you can either draw a filled rectangle over the old text in the background colour before printing the new text or set the text colour to the same as the background, print the old text then set the text colour to what you want and print the new text.
You do that before using display.display, which you only need once at the end.

The next thing you need to learn is to only send stuff to the display when something changes, not every time around loop. Read some of the tutorials on here, have a think and come back.