开发者

want to extract subject, to and body of an email from a text which are separated by :

This is the text message i got from my qrdecoder android application:

SMTP:test@te开发者_运维知识库st.com:QR demo:Hi admin,
please find the attached
Thanks
test

i want to extract emailid, subject i.e QR demo and body of the message.

so that i can call an intent to send email.

{
Intent emailIntent = new Intent(Intent.ACTION_SEND);

String aEmailList[] = { "some_email@domain.com"};

emailIntent.putExtra(Intent.EXTRA_EMAIL, aEmailList);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Sample Subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "");

emailIntent.setType("message/rfc822");

startActivity(Intent.createChooser(emailIntent, "Select Email Application"));
}


Have a look at java.util.StringTokenizer class: http://developer.android.com/reference/java/util/StringTokenizer.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜