I am new to this but what is wrong with my snippet of coding? I am getting the error: 'This action is not currently supported' when I select the link. Here is my code:
public void addEmail() {
TextView txt = (TextView) findViewById(R.id.emailtext);
txt.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
Intent intent = new Intent();
String uriText =
"mailto:[email protected]" +
"?subject=" + URLEncoder.encode("some subject text here") +
"&body=" + URLEncoder.encode("some text here");
Uri uri = Uri.parse(uriText);
Intent sendIntent = new Intent(Intent.ACTION_SENDTO);
sendIntent.setData(uri);
startActivity(Intent.createChooser(sendIntent, "Send email"));
}});
}
Many thanks!
Intent
? It appears the answer below (that you confirmed) goes the same direction. This is how I thought my link addressed the error. My bad if it does not. – SolicitsetData
, and the intent not matching anything. The code in this question actually seems better than thesetType
approach since, according to comments on some SO answers, that approach causes Skype and other non-email clients to match the intent. – Choric