1

My problem:

In my application I read the address details from a SQLite database & display the result in a textview.

My sqlite sample address - 41 South Station Road,'\n' Colchester, '\n' CO1 1RQ

But the next line using '\n' is not working. It prints directly '\n' in the textview.

My output:

enter image description here

What I have tried

From this question:

41 South Station Road,"\\n" Colchester, "\\n" CO1 1RQ

41 South Station Road,"\n" Colchester, "\n" CO1 1RQ

41 South Station Road,\n Colchester, \n CO1 1RQ

All of the above are not working.

Community
  • 1
  • 1
Ranjithkumar
  • 16,071
  • 12
  • 120
  • 159

1 Answers1

1

this code solve my problem..

 string = string.replace("\\\n", System.getProperty("line.separator")); 

reference - https://stackoverflow.com/a/16287239/3879847

thanks to @Robert

Community
  • 1
  • 1
Ranjithkumar
  • 16,071
  • 12
  • 120
  • 159