从SQLite

时间:2015-06-26 04:02:17

标签: java android string sqlite

我的问题:

在我的应用程序中,我从SQLite数据库中读取了地址详细信息。在文本视图中显示结果。

我的sqlite示例地址 - 41 South Station Road,' \ n'科尔切斯特,' \ n' CO1 1RQ

但下一行使用' \ n'不管用。它直接打印' \ n'在textview中。

我的输出:

enter image description here

我尝试了什么

来自this question:

41 South Station Road," \\ n"科尔切斯特," \\ n" CO1 1RQ

41 South Station Road," \ n"科尔切斯特," \ n" CO1 1RQ

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

以上所有都不起作用。

1 个答案:

答案 0 :(得分:1)

这段代码解决了我的问题..

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

参考 - https://stackoverflow.com/a/16287239/3879847

感谢@Robert