Created
August 23, 2019 10:07
-
-
Save hitesh-dhamshaniya/565c4178526d42fb7b72341d7b0e8819 to your computer and use it in GitHub Desktop.
Basic Method require frequently for common functionality.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @author Hitesh | |
| * @version 1.0 | |
| * @since 23-08-2019 | |
| */ | |
| class IntentHelper() { | |
| fun launchCall(mActivity: Activity, phoneNumber: String) { | |
| val intent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$phoneNumber")) | |
| mActivity.startActivity(intent) | |
| } | |
| fun launchMail(mActivity: Activity, emailAddress: String) { | |
| val intent = Intent(Intent.ACTION_SENDTO) | |
| intent.type = "text/html" | |
| intent.putExtra(Intent.EXTRA_EMAIL, "emailaddress@gmail.com") | |
| intent.putExtra(Intent.EXTRA_SUBJECT, "Subject") | |
| intent.putExtra(Intent.EXTRA_TEXT, "I'm email body.") | |
| mActivity.startActivity(Intent.createChooser(intent, "Send Email")) | |
| } | |
| fun launchMap(mActivity: Activity, lat: String, lng: String) { | |
| val intent = Intent( | |
| Intent.ACTION_VIEW, | |
| Uri.parse("geo:0,0?q=$lat,$lng (Mas Insurance Group)") | |
| ) | |
| mActivity.startActivity(intent) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment