1
How do I delete a text after sending.
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" />
editText.setText("");
– Antonio S. Junior
editText.setText("");
is the right answer, I do not understand why @Antonios.Junior put as comment.– Vitor Ramos
I’ll put it in answer, it was bad!
– Antonio S. Junior