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..
mOrderList = db.getOrderList();
// getting all arrayList content
for (int i = 0; i < 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("<html><h4>Customer Order List</h4>" + "<body> <table>"
+ "<tr><th>Item No</th>" + "<th>Item Name</th>"
+ "<th>Unit</th>" + "<th>QTY</th>" + "<th>Item Rate</th>"
+ "<th>Amount</th></tr>");
mbufferWriter.append("<tr><td>" +no+"</td>");
mbufferWriter.append("<td>"+itemName+ "<td>");
mbufferWriter.append("<td>"+unit+ "<td>");
mbufferWriter.append("<td>"+qty+ "<td>");
mbufferWriter.append("<td>"+rate+ "<td>");
mbufferWriter.append("<td>"+amt+ "<td></tr>");
mbufferWriter.append("</body></table></html>");
mbufferWriter.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}//for
and trying to send an email like this but it gives error...
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();
}
can any one help me fix this problem .. Thanks in advance..
` tag or `
` or ` ` space tag as per your needs.
,
, ...
– CrazyMind Apr 12 '13 at 06:00