Office Hours — Today, July 6

Thursday, June 30

Jul 6
3:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:00 PM
Yacire
has entered the room
Mark M.
hello, Yacire!
how can I help you today?
Yacire
Hello Mark
4:05 PM
Yacire
i have a question about implicit intent; i want to send a highlighted text with a web clikable link through implicit intent but i have no idea how i can do this. I have already a text but it is not highlighted and i don't know how to add a web clikable link to my text
Mark M.
extras, like EXTRA_TEXT for ACTION_SEND, support CharSequence, not merely String
so, use a SpannableStringBuilder, or Html.fromHtml(), to create a CharSequence that has the formatting and link that you want
then put that in the extra
the recipient needs to also treat the result as a CharSequence, not merely a string
and if you are not implementing the app that is responding to the Intent, you do not have any control over how it uses your CharSequence, so it might strip out the formatting
4:10 PM
Yacire
Ok, thanks. And is it possible to highlighted a text to send through implicit intent ?
Mark M.
yes, I just explained that
implicit Intent and explicit Intent make no difference here
so long as you have the formatting in the CharSequence that you use for the extra, you are doing all that you can to have a formatted result
Yacire
Ok and i can formatted the text with the Class SpannableStringBuilder ?
Mark M.
yes
that sample app highlights words in a piece of text, based on what the user enters into a search field
it uses SpannableString, since the text does not change, just the formatting
SpannableStringBuilder allows you to build up both the text (akin to StringBuilder) and how it is formatted
Yacire
Ok it's now clear, thanks a lot !
4:30 PM
Yacire
has left the room
4:55 PM
Mark M.
turned off guest access

Thursday, June 30

 

Office Hours

People in this transcript

  • Mark Murphy
  • Yacire