Erase text in the EditText field

2

How do I delete text after submission.

    enviar.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            String value = editText.getText().toString();

            //push creates a unique id in database
            demoRef.push().setValue(value);

            Toast.makeText(TelaPolicia.this,
                    "Enviando", Toast.LENGTH_LONG).show();



        }
    });
    <EditText
        android:id="@+id/editescrever"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/btnenviar"
        android:layout_alignParentStart="true"
        android:layout_marginBottom="31dp"
        android:layout_marginStart="19dp"
        android:ems="10"
        android:hint="Escreva o incidente"
        android:inputType="textPersonName"
        android:textSize="18sp" />

    <Button
        android:id="@+id/btnenviar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="123dp"
        android:text="Enviar" /> 
    
asked by anonymous 19.01.2018 / 14:09

1 answer

4

Set your EditText to the value you want after your send action. In your case it would be:

editText.setText("");
    
19.01.2018 / 14:40