问题
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");
回答1:
Try this:
Intent i = new Intent(AddText.this,GetText.class);
i.putExtra("data",(editText.getText().toString()).replaceAll("\\n", "\n"));
startActivity(i);
回答2:
use \n whereever you want to use new line. in your code.
for suppose if you want to save pdf with name Android\npdf then you must type like this only and you can get string
来源:https://stackoverflow.com/questions/14473037/how-to-save-new-line-from-android