In my registration application I have the name and phone information. After entering the information and clicking on register, a text file is created with the information registered.
But I would like the created text file to be named with the name field information.
Example:
Name: Joao
Phone: 123
Text file created: Joao.txt
Currently, I create and name the file with the following command:
FileOutputStream ArqTexto = new FileOutputStream(Environment.getExternalStorageDirectory() + "/Clientes.txt");
I have already stored the value entered in the name field in a variable, but I do not know how to do the correct syntax.
I tried this way:
FileOutputStream ArqTexto = new FileOutputStream(Environment.getExternalStorageDirectory() + VariavelNome +".txt");
But it did not work.