如何从Android保存新行? [英] How to save new line from android?
本文介绍了如何从Android保存新行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在保存来自编辑文本框的数据,然后将其保存到pdf中.它可以正常工作,但是如果我将文本写入多行中,则将其作为单行...并用单行制作pdf文件...所以我怎样才能将新行保存到pdf中呢???这是发送数据以保存数据的代码...
I am saving data from edit textbox and getting that to save into pdf....It works fine but if i write text into multiline....it takes as single line...and make pdf file with single line...so how can i get the new line to save into pdf??? Here is code which send data for save data...
Intent i = new Intent(AddText.this,GetText.class);
i.putExtra("data",editText.getText().toString());
startActivity(i);
在下一页中,我正在获取数据....
And in next page i am getting data....
String data = getIntent().getExtras().getString("data");
推荐答案
尝试一下:
Intent i = new Intent(AddText.this,GetText.class);
i.putExtra("data",(editText.getText().toString()).replaceAll("\\n", "\n"));
startActivity(i);
这篇关于如何从Android保存新行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文