Is it possible to concatenate a textview with a log so that it shows me the value of this in the log? That is, if a variable can be created and it is sent to the log to show the value of the textview it is receiving.
Is it possible to concatenate a textview with a log so that it shows me the value of this in the log? That is, if a variable can be created and it is sent to the log to show the value of the textview it is receiving.
To add more information to Curro's answer, I show you different types of log with its possible uses.
Log.e(LOGTAG, "Mensaje de error");
Log.w(LOGTAG, "Mensaje de warning");
Log.i(LOGTAG, "Mensaje de información");
Log.d(LOGTAG, "Mensaje de depuración");
Log.v(LOGTAG, "Mensaje de verbose");
At the time of concatenating, you can do two things:
Concatenate directly by getting the result of the TEXT in the same log as Curro partner has explained.
Log.e(LOGTAG, "Mensaje de error" + txtView.getText().tostring());
Log.w(LOGTAG, "Mensaje de warning" + txtView.getText().tostring());
Log.i(LOGTAG, "Mensaje de información" + txtView.getText().tostring());
Log.d(LOGTAG, "Mensaje de depuración" + txtView.getText().tostring());
Log.v(LOGTAG, "Mensaje de verbose" + txtView.getText().tostring());
Or you save the text content in a variable and that's easier to see.
// Guardamos el texto de tu TextView en la variable de tipo String textObtenido
String textObtenido = txtTexto.getText().ToString()
Log.e(LOGTAG, "Mensaje de error" + textObtenido);
Log.w(LOGTAG, "Mensaje de warning" + textObtenido);
Log.i(LOGTAG, "Mensaje de información" + textObtenido);
Log.d(LOGTAG, "Mensaje de depuración" + textObtenido);
Log.v(LOGTAG, "Mensaje de verbose" + textObtenido);
Image to see it working:
I hope it serves you!
If you can and also very simple:
Log.e("DEBUG_LOG", "Mensaje de error " + tutextview.gettext().tostring());
Instead of Log.e you can use the type of log that interests you, that is an example.
I hope it serves you. Greetings