开发者

Android mailing problem

开发者 https://www.devze.com 2023-02-25 10:26 出处:网络
I have a little but annoying problem. I have made an app where the user can give some directions and then send them by email later.

I have a little but annoying problem. I have made an app where the user can give some directions and then send them by email later.

The problem is that when the user send the directions it do not change line if the user have pressed enter in the app. I am storing the directions as a String in the database on the phone.

It is showed correctly in the app.

Anyone kn开发者_如何学编程ows what can be done?

EDIT

I am sending the mail by

intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("text/html");
intent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
context.startActivity(Intent.createChooser(intent, "Share Via:"));

Thank you


Replace carriage returns with <br /> tags, eg:

html = Html.fromHtml(body.replace("\n", "<br/>"));


Can you try to print Html.fromHtml(body) to your log and see if the ENTER is seen?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号