문제 설명
내 앱의 피드백 양식에 채워진 텍스트를 내 이메일 주소로 가져오는 방법은 무엇입니까? 자세한 내용을 참조하십시오 (How to get the text filled in feedback form of my app to my email address? Please see details)
내 Android 앱에서 피드백 양식을 만들었습니다.
내가 원하는 것은 해당 양식(editText
) 다른 앱을 열지 않고 내 이메일 주소로 전달되도록 합니다.
이 작업을 수행하는 방법을 알 수 없었지만 다음 방법을 생각했습니다. 지금까지:
EditText etUserLikeResponse = (EditText) findViewById(R.id.user_like_response);
EditText etUserDontLikeResponse = (EditText) findViewById(R.id.user_dont_like_response);
EditText etUserOtherFeaturesResponse = (EditText) findViewById(R.id.user_other_features_response);
String etUserLikeResponseText = etUserLikeResponse.getText().toString();
String etUserDontLikeResponseText = etUserDontLikeResponse.getText().toString();
String etUserOtherFeaturesResponseText = etUserOtherFeaturesResponse.getText().toString();
Uri etUserLikeResponseTextUri = Uri.parse(etUserLikeResponseText);
Uri etUserDontLikeResponseTextUri = Uri.parse(etUserDontLikeResponseText);
Uri etUserOtherFeaturesResponseTextUri = Uri.parse(etUserOtherFeaturesResponseText);
final ArrayList<Uri> userResponseUri = new ArrayList<>();
userResponseUri.add(etUserLikeResponseTextUri);
userResponseUri.add(etUserDontLikeResponseTextUri);
userResponseUri.add(etUserOtherFeaturesResponseTextUri);
Button btnSendFeedback = (Button) findViewById(R.id.btn_send_feedback);
btnSendFeedback.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final Handler handler2 = new Handler();
handler2.postDelayed(new Runnable() {
@Override
public void run() {
Intent userFeedbackIntent = new Intent();
userFeedbackIntent.setAction(Intent.ACTION_SEND_MULTIPLE);
userFeedbackIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, userResponseUri);
userFeedbackIntent.setType("message/rfc822");
userFeedbackIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"abc.xyz321ba@gmail.com"});
startActivity(userFeedbackIntent);
}
}, 200);
}
});
처음에 EditText
로 작성된 텍스트를 캡처했습니다. & 그런 다음 http: //developer.android.com/training/sharing/send.html
내가' btnSendFeedback
을 클릭하고 Gmail을 선택하면 '파일을 첨부할 수 없습니다'라는 메시지가 표시됩니다.
저는 초보자입니다. 제가 뭘 잘못하고 있는지 알 수 없습니다.
알려주세요 & 이 작업을 수행할 수 있는 또 다른 좋은 방법이 있다면 알려주세요.
질문 형식이 잘못되어 죄송합니다.
감사합니다.
참조 솔루션
방법 1:
Ok, seems like you are using Intent.EXTRA_STREAM
which involves a 'file', and you don't have any file, don't you? (check this answer: Android: Intent.ACTION_SEND with EXTRA_STREAM doesn't attach any image when choosing Gmail app on htc Hero), So you can create a txt file and then try to attach it to your email.
Other option can be just fill the body of your email (check: Send Email Intent ) with the data that you want to send.
Update : If you want to send an email with the data in the body of your email see Developer.android.com: Email intent
And if you want to avoid other app in the procces you can check this so answer: Sending email in android using javamail api without using the default built in app
(by user4909407、mayo)