Using Anko Common in android studio with kotlin - Joklinz-Tech

Latest

Home Of Tech news,jobs and android tutorials

Sunday, 31 December 2017

Using Anko Common in android studio with kotlin


Add it as a dependency to your build.gradle:
dependencies {
    compile "org.jetbrains.anko:anko-commons:$anko_version"
}

Useful Intent callers

Anko has call wrappers for some widely used Intents:
GoalSolution
Make a callmakeCall(number) without tel:
Send a textsendSMS(number, [text]) without sms:
Browse the webbrowse(url)
Share some textshare(text, [subject])
Send a emailemail(email, [subject], [text])

Example 

val btn = findviewById(R.id.button) as Button

btn.setOnclicklistner{

makeCall("079504838383")

}

btn.setOnclicklistner{

sendSMS("079504838383")

}

btn.setOnclicklistner{

email("wise4rmgod@gmail.com")

}

No comments:

Post a Comment