i have issue with Droid X phone for sending attached email from my Application.My Code working good for All other Android devices Like HTC,Samsung galaxy,Milestone. But i have problem with Droid X only.I saved my html file in the sdcard but i can not attached it in the email. i recived the empty mail, i didnt get the attachement in the droid x mobile.
here i attached my code…
save file in the sdcard:
protected void savehtml(HtmlViwer htmlViwer, String htmlcontent2,String string) {
try {
File root = new File(Environment.getExternalStorageDirectory(),"PalmAgent");
if (!root.exists()) {
root.mkdirs();
}
String sdcardhtmlpath = root.getPath().toString() + "/print.html";
FileWriter fstream = new FileWriter(sdcardhtmlpath);
BufferedWriter out = new BufferedWriter(fstream);
out.write(htmlcontent2);
out.close();
} catch (Exception e) {// Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
sending mail with attachment:
Intent sentinIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sentinIntent.setType("plain/text");
ArrayList<Uri> uris = new ArrayList<Uri>();
File root = new ile(Environment.getExternalStorageDirectory(), "PalmAgent");
String sdcardhtmlpath = root.getPath().toString()+ "/print.html";
String[] filePaths = new String[] { sdcardhtmlpath };
for (String file : filePaths) {
File fileIn = new File(file);
Uri u = Uri.fromFile(fileIn);
uris.add(u);
}
sentinIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(Intent.createChooser(sentinIntent,"Send mail via"));
}
Finally I found the solution… while connecting to the PC the sdcard share its memory with PC so that I cannot access the sdcard that time. And also same device comes without memory card