Intents
을 사용하면 어떻게 편리할까요? Android에는 시스템 내에서 특정 작업을 수행하는 사전 정의 된 Intents가 있습니다. 이전에 사진을 클릭했을 수도 있고 갤러리 또는 Astro와 같은 타사 응용 프로그램에서 볼 것인지 묻는 대화 상자가 나타날 수도 있습니다. 이미지보기에는 자체 사전 결정된 의도가 있습니다.
이메일을 보내는 경우 미리 결정된 의도가 있습니다 (android.content.Intent.ACTION_SEND
). 이 속성으로 인 텐트를 만든 다음 추가 정보 (예 : 보낼 주소, 제목/메시지 본문 등)를 첨부해야합니다.
예제 코드 :
// Data members
private Intent emailIntent;
private String feedback;
private EditText feedbackBox;
// Create the Intent, and give it the pre-defined value
// that the Android machine automatically associates with
// sending an email.
emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
// Put extra information into the Intent, including the email address
// that you wish to send to, and any subject (optional, of course).
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Insert subject here");
// Acquire feedback from an EditText and save it to a String.
feedback = feedbackBox.getText().toString();
// Put the message into the Intent as more extra information,
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, feedback);
// Start the Intent, which will launch the user's email
// app (make sure you save any necessary information in YOUR app
// in your onPause() method, as launching the email Intent will
// pause your app). This will create what I discussed above - a
// popup box that the user can use to determine which app they would like
// to use in order to send the email.
startActivity(Intent.createChooser(emailIntent, "Insert title for dialog box."));
나는이 도움이 희망! 체크 아웃하는 것 같아서
일부 소스 :
http://developer.android.com/guide/topics/intents/intents-filters.html
http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND
당신이이 포스트를 보면, Gmail을 사용하려는 경우, http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-android-ap – aacanakin