2011-11-14 11 views
1

私は次のような問題があります。Androidのメールの意図と改行Howto?

私はインテントで電子メールを送信していますが、電子メールでは改行が必要です。

"setType( 'text/plain')を試して\ nを使用すると、Email-Appはこれらを使用しませんが、Gmail-AppはOKです。 "setType( 'text/html')を設定し、brとHtml.fromHtml(emailtext)を使用すると、Email-appは改行を行いません。私がHtml.fromHtml(emailtext)を使用していないとき、Email-appは改行を行いますが、Gmail-Appは通常のテキストとしてbrを表示します。

Androidのメールインテントで簡単な改行を行う方法はありませんか?

答えて

0

やあ、このコードをbであり、この

Intent emailIntent = new Intent(Intent.ACTION_VIEW); 
emailIntent.setClassName("com.google.android.gm", 
        "com.google.android.gm.ComposeActivityGmail"); 
startActivity(emailIntent); 

使用\ nによって、あなたのテキストコードに出て

String emailMessage = "<html><body><div align='left'><p>I found this information on Actor Genie and wanted to share it with you.</p><p><b>Feature </b>: " 
         + filmName 
         + "</p><p><b>Casting Director</b>: " 
         + casting 
         + "</p><p><b>Distributor</b>: " 
         + distributor 
         + "<p><b>Story Line</b>: " 
         + storyLine 
         + "</p><p>For up to the date casting info get <a href='http://www.actorgenie.com/'>Actor Genie</a></p></div></body></html>"; 
       Intent emailIntent = new Intent(
         android.content.Intent.ACTION_SEND); 
       // emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, ""); 
       emailIntent.setType("text/html"); 
       emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, 
         emailSubject); 
       emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html 
         .fromHtml(emailMessage)); 
       startActivity(Intent.createChooser(emailIntent, "Send mail...")); 
       finish(); 
+0

いいえ、それは何も変わりませんでした。それは基本的に私がやっていることですが、私はちょうどこれらのhtml + body部分を持っていませんでした。私がHtml.fromHtmlを実行すると、Email-appはこのhtmlタグをもう使用しないようです。ちなみに、Samsung Galaxy S2です。 – Tobi

+0

それは私のために働いています私はサムスンエースとHTC Desireでそれをテストしました –

0

フォースのGmailのuを助けます。

emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Hello \n World"); 
+1

私は強制的にgmailをしたくありません。それはビジネスアプリのためのものなので、人々は彼らが望むどんな電子メールクライアントを使用することを許可されるべきです。 – Tobi

関連する問題