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
精彩评论