-
private void SendEmail(String subject, String text, ArrayList<String>filePaths, String... addressTo) {
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/jpeg");
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "subject");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+filePaths.get(0)));
sendIntent.putExtra(Intent.EXTRA_TEXT, "Enjoy the photo");
startActivity(Intent.createChooser(sendIntent, "Email:"));
}
* Case MMS
-
private void SendMMS(Context context, ArrayList<String> urlString) {
boolean exceptionCheck = false;
Intent sendIntent = new Intent();
// Selection count
if (urlString.size() > 1) {
sendIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
} else if (urlString.size() == 1) {
sendIntent.setAction(Intent.ACTION_SEND);
} else {
Toast.makeText(this, "Please Check the Image.", Toast.LENGTH_LONG)
.show();
exceptionCheck = true;
}
if (!exceptionCheck) {
sendIntent.setData(Uri.parse("mmsto:"));
sendIntent.addCategory("android.intent.category.DEFAULT");
ArrayList<Uri> uris = new ArrayList<Uri>();
for (String file : urlString) {
File fileIn = new File("file://" + file);
Uri u = Uri.fromFile(fileIn);
uris.add(u);
}
sendIntent.setType("image/jpeg");
if (urlString.size() > 1) {
sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,
uris);
} else {
sendIntent.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file://" + urlString.get(0)));
}
}
try {
startActivity(sendIntent);
} catch (Exception e) {
Toast.makeText(this, "Send Failed..", Toast.LENGTH_LONG).show();
}
}
'Android' 카테고리의 다른 글
Android https post (0) | 2012.04.16 |
---|---|
안드로이드에서 SSL통신 (0) | 2012.04.16 |
Android 미디어스캔 (0) | 2011.10.21 |
Android에서 C2DM 사용하기 (0) | 2011.10.19 |
버튼에 이미지와 텍스트 (0) | 2011.10.17 |