-1

I am developing an android application and I want to do something but I didn't even know what it called so i'm asking to get some help.

This is a part of my application :

Current Output

and I want to make it like this by adding any text there which I can copy it into the clipboard and paste it in another place

Expected Output

I don't know what it called and I don't know how I gonna do it

well it's like inserting a code in this website but I want it in my app

Thanks!

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141

1 Answers1

-1

here it is the problem, when i put my own text using quotes in the EditText :

  <EditText
        android:id="@+id/editText"
        android:layout_below="@+id/ArduinoText"
        android:layout_width="match_parent"
        android:layout_height="495dp"
        android:layout_marginBottom="16dp"
        android:layout_marginRight="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="16dp"
        android:background="@android:color/white"
        android:ems="10"
        android:gravity="top"
        android:inputType="textMultiLine"
        android:padding="10dp"
        android:singleLine="true"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:text="char command;
String string;
boolean ledI = false;
boolean ledII = false;
#define led1 1
#define led2 2
#define led3 11
#define led4 22
  void setup()
  {
    Serial.begin(9600);
    pinMode(led1, OUTPUT);// led of BT
    pinMode(led2, OUTPUT);// led of BT
    pinMode(led3, OUTPUT);// led of BT
    pinMode(led4, OUTPUT);
  }

  void loop()
  {
    if (Serial.available() > 0)
    {string = "";}

    while(Serial.available() > 0)
    {
    command = ((byte)Serial.read());

    if(command == ':')
    {
    break;
    }

    else
    {
    string += command;
    }

    delay(1);
    }

    if(string == "O")
    {
    ledO();
    ledI = true;
    }
    if(string == "OO")
    {
    ledOO();
    ledII = true;
    }

    // ---------
    if(string =="X")
    {
    ledX();
    ledI = false;
    Serial.println(string);
    }
    if(string =="XX")
    {
    ledXX();
    ledII = false;
    Serial.println(string);
    }

    }
    void ledO(){

    digitalWrite(led1, HIGH);
    digitalWrite(led2, HIGH);
    delay(100);
    }
    void ledOO(){

    digitalWrite(led2, HIGH);
    digitalWrite(led4, HIGH);
    delay(100);
    }

    void ledX(){

    digitalWrite(led1, LOW);
    delay(10);
    digitalWrite(led2, LOW);
    delay(10);
    }

    void ledXX(){

    digitalWrite(led3, LOW);
    delay(10);
    digitalWrite(led4, LOW);
    delay(10);
    }"
        />