Search code examples
javadialogcodenameoneword-wrap

How to wrap text in Dialog


I'm trying to wrap the text in a Dialog, but I couldn't find the way. I tried with \n but it is not working. enter image description here enter image description here

Where am I wrong? Thanks in advance for any answer. Luca


Solution

  • I solved thanks to Shai Almog's comment. That's the relevant code:

    Dialog.show(lg.nome, StringUtil.replaceAll(lg.testo,"\\n","\n") + "\n (da: " + lg.libro + ", pag." + lg.pagina + ")", "Chiudi",null);}
    

    It works fine, and I can wrap the text from the XML file as I need.

    Bye Luca