Thursday, 15 May 2014

android - Formatted text in ACTION_SEND intent -



android - Formatted text in ACTION_SEND intent -

i want share formatted text android application using action_send intent , i've found can utilize tag. works sharing html text email, if seek share facebook, twitter, hangout, no text showed. of course of study can't interpret html code. how can handle different sharing ways code formatted ? code:

spanned sharebody = html.fromhtml(context.getstring(r.string.suggest_text)); intent sharingintent = new intent(android.content.intent.action_send); sharingintent.settype("text/plain"); sharingintent.putextra(android.content.intent.extra_subject, context.getstring(r.string.suggest_subject)); sharingintent.putextra(android.content.intent.extra_text, sharebody); startactivity(intent.createchooser(sharingintent, context.getstring(r.string.share_with)));

and value in strings.xml

<string name="suggest_text"> <![cdata[ <p>hey,</p> <p>good morning</p> <p><a href="http://www.someurl.bla">click here</a> ]]> </string>

try this

shareintent.putextra( intent.extra_text, html.fromhtml(new stringbuilder() .append("<p><b>hey,</b></p>") .append("<small><p>good morning</p></small>") .tostring()) );

android android-intent text formatted

No comments:

Post a Comment