In the following steps, we will see how to share text using an intent:
- Anko provides a share method, which takes in a string parameter, that is, the text to share and an optional parameter subject. The subject parameter can be particularly useful to share text via an email app. After all, who sends a subject for a whatsapp message, right? Let's see its implementation:
share("Hey","Some subject")
- Without the subject—this won't fill in the subject line in the mail:
share("Hey")
It's that simple!