MailTo
class MailTo
kotlin.Any | |
↳ | androidx.core.net.MailTo |
MailTo URI parser. Replacement for android.net.MailTo
.
This class parses a mailto scheme URI and then can be queried for the parsed parameters. This implements RFC 6068.
Note: scheme name matching is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your URI with the scheme using lower case letters, and normalize any URIs you receive from outside of Android to ensure the scheme is lower case.
Summary
Constants | |
---|---|
static String |
Public methods | |
---|---|
String? |
getBcc() Retrieve the BCC address line from the parsed mailto URI. |
String? |
getBody() Retrieve the body line from the parsed mailto URI. |
String? |
getCc() Retrieve the CC address line from the parsed mailto URI. |
MutableMap<String!, String!>? |
Retrieve all the parsed email headers from the mailto URI |
String? |
Retrieve the subject line from the parsed mailto URI. |
String? |
getTo() Retrieve the To address line from the parsed mailto URI. |
static Boolean |
Test to see if the given string is a mailto URI |
static Boolean |
Test to see if the given Uri is a mailto URI |
static MailTo |
Parse and decode a mailto scheme string. |
static MailTo |
Parse and decode a mailto scheme Uri. |
String |
toString() |
Constants
Public methods
getBcc
@Nullable fun getBcc(): String?
Retrieve the BCC address line from the parsed mailto URI. This could be several email address that are comma-space delimited. If no BCC line was specified, then null is return
Return | |
---|---|
String? |
comma delimited email addresses or null |
getBody
@Nullable fun getBody(): String?
Retrieve the body line from the parsed mailto URI. If no body line was specified, then null is return
Return | |
---|---|
String? |
body or null |
getCc
@Nullable fun getCc(): String?
Retrieve the CC address line from the parsed mailto URI. This could be several email address that are comma-space delimited. If no CC line was specified, then null is return
Return | |
---|---|
String? |
comma delimited email addresses or null |
getHeaders
@Nullable fun getHeaders(): MutableMap<String!, String!>?
Retrieve all the parsed email headers from the mailto URI
Return | |
---|---|
MutableMap<String!, String!>? |
map containing all parsed values |
getSubject
@Nullable fun getSubject(): String?
Retrieve the subject line from the parsed mailto URI. If no subject line was specified, then null is return
Return | |
---|---|
String? |
subject or null |
getTo
@Nullable fun getTo(): String?
Retrieve the To address line from the parsed mailto URI. This could be several email address that are comma-space delimited. If no To line was specified, then null is return
Return | |
---|---|
String? |
comma delimited email addresses or null |
isMailTo
static fun isMailTo(@Nullable uri: String?): Boolean
Test to see if the given string is a mailto URI
Note: scheme name matching is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your URI string with the scheme using lower case letters, and normalize any URIs you receive from outside of Android to ensure the scheme is lower case.
Parameters | |
---|---|
uri |
String?: string to be tested |
Return | |
---|---|
Boolean |
true if the string is a mailto URI |
isMailTo
static fun isMailTo(@Nullable uri: Uri?): Boolean
Test to see if the given Uri is a mailto URI
Note: scheme name matching is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your Uri with the scheme using lower case letters, and normalize any Uris you receive from outside of Android to ensure the scheme is lower case.
Parameters | |
---|---|
uri |
Uri?: Uri to be tested |
Return | |
---|---|
Boolean |
true if the Uri is a mailto URI |
parse
@NonNull static fun parse(@NonNull uri: String): MailTo
Parse and decode a mailto scheme string. This parser implements RFC 6068. The returned object can be queried for the parsed parameters.
Note: scheme name matching is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your URI string with the scheme using lower case letters, and normalize any URIs you receive from outside of Android to ensure the scheme is lower case.
Parameters | |
---|---|
uri |
String: String containing a mailto URI |
Return | |
---|---|
MailTo |
MailTo object |
Exceptions | |
---|---|
ParseException |
if the scheme is not a mailto URI |
parse
@NonNull static fun parse(@NonNull