Problems adding and retrieving text with newlines in SQLite Android -


so can add data data base fine when try , add

test sentence

testing sentence two

to data base retrieve i'm getting

test sentence testing sentence two

i'm adding test data string enter put in , there no way in code me ad \n since i'm pulling data textview string , saving database.

well can try add \n. read each character of string , find location of return character. in new string copy contents before character, copy '\n' , copy rest of content of string.

here's code:

public void onclick(view arg0) {      string s=ed.gettext().tostring();     int index=0;     for(int i=0;i<s.length();i++){         if(s.charat(i)==10){             index=i;         }     }     string temp=s.substring(0, index);     temp=temp+'\n';     temp=temp+s.substring(index+1, s.length());     tv.settext(temp); } 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -