Convert the text into word document and that document send to Mail in Android:
File myFile;
File myFile;
Button share=(Button) findViewById(R.id.butshare);
share.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
0.String text =et.getText().toString();
try {
myFile = new File("/sdcard/FresherResume.doc");
myFile.createNewFile();
FileOutputStream fOut = new FileOutputStream(myFile);
OutputStreamWriter myOutWriter =new OutputStreamWriter(fOut);
myOutWriter.append(text);
myOutWriter.close();
fOut.close();
Intent email = new Intent(Intent.ACTION_SEND);
email.setType("plain/text");
email.putExtra(Intent.EXTRA_EMAIL, new String[] { "please enter To Address" });
email.putExtra(Intent.EXTRA_SUBJECT, "Resume");
email.putExtra(Intent.EXTRA_TEXT, "Please find attachment");
email.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(myFile));
startActivity(email);
}
catch (Exception e)
{
Toast.makeText(TemplateActivity.this, e.getMessage(),Toast.LENGTH_SHORT).show();
}
}
});
No comments:
Post a Comment