Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android,Problem:Trying to Send a Link By email

Tags:

android

i am sending a simple email and in the body i put a Link .

My problem is the link is not recognize as Link but only as String

Here the code:

 intent.putExtra(Intent.EXTRA_EMAIL,new String[]{ "[email protected]"}); 
       Uri myUri = Uri.parse("http://www.stackoverFlow.com/");
       intent.putExtra(Intent.EXTRA_TEXT,  "Check out this great application:"+"\n"+ myUri);  
       intent.putExtra(Intent.EXTRA_SUBJECT, "Traveler's Pharmacy");
       intent.setType("text/plain");   
       startActivity(Intent.createChooser(intent, "Choose Email Client"));
       startActivity(intent);

Thanks for helping

like image 251
bifko Avatar asked Dec 27 '22 21:12

bifko


1 Answers

Change this two lines:

intent.setType("text/html");  

and

intent.putExtra(Intent.EXTRA_TEXT,  
                Html.fromHtml("Check out this great application: <a href=\""+ myUri+
                "\">Link</a>"));  
like image 182
Peter Knego Avatar answered Dec 30 '22 13:12

Peter Knego