Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to send email with html table output in email
    primarykey
    data
    text
    <p>I am working on ArrayList, i want to send email type of html format with arraylist content, i am trying to write array content in BufferedWriter Like.. </p> <pre><code>mOrderList = db.getOrderList(); // getting all arrayList content for (int i = 0; i &lt; mOrderList.size(); i++) { no = mOrderList.get(i).getId(); itemName = mOrderList.get(i).getOrderItemName(); unit = mOrderList.get(i).getOrderUnit(); qty = mOrderList.get(i).getOrderQTY(); rate = mOrderList.get(i).getOrderRate(); amt = mOrderList.get(i).getOrderAmount(); try { mbufferWriter =new BufferedWriter(new FileWriter("/data/data/com.sample.category/abc.txt")); mbufferWriter.write("&lt;html&gt;&lt;h4&gt;Customer Order List&lt;/h4&gt;" + "&lt;body&gt; &lt;table&gt;" + "&lt;tr&gt;&lt;th&gt;Item No&lt;/th&gt;" + "&lt;th&gt;Item Name&lt;/th&gt;" + "&lt;th&gt;Unit&lt;/th&gt;" + "&lt;th&gt;QTY&lt;/th&gt;" + "&lt;th&gt;Item Rate&lt;/th&gt;" + "&lt;th&gt;Amount&lt;/th&gt;&lt;/tr&gt;"); mbufferWriter.append("&lt;tr&gt;&lt;td&gt;" +no+"&lt;/td&gt;"); mbufferWriter.append("&lt;td&gt;"+itemName+ "&lt;td&gt;"); mbufferWriter.append("&lt;td&gt;"+unit+ "&lt;td&gt;"); mbufferWriter.append("&lt;td&gt;"+qty+ "&lt;td&gt;"); mbufferWriter.append("&lt;td&gt;"+rate+ "&lt;td&gt;"); mbufferWriter.append("&lt;td&gt;"+amt+ "&lt;td&gt;&lt;/tr&gt;"); mbufferWriter.append("&lt;/body&gt;&lt;/table&gt;&lt;/html&gt;"); mbufferWriter.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }//for </code></pre> <p>and trying to send an email like this but it gives error...</p> <pre><code>Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[] { "abc@gmail.com" }); i.putExtra(Intent.EXTRA_SUBJECT, "sample email sending"); i.putExtra(Intent.EXTRA_TEXT,Html.toHtml((Spanned) mbufferWriter)); try { startActivity(Intent.createChooser(i, "Send mail...")); // startActivity(i); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(EmailActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } </code></pre> <p>can any one help me fix this problem .. Thanks in advance..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload