1. 程式人生 > >Anko使用指南(一)之Intent

Anko使用指南(一)之Intent

詳細 enter 發送 ron clas ali number jetbrains url

使用Anko Intent幫助器可以添加如下依賴

dependencies {
    compile "org.jetbrains.anko:anko-commons:$anko_version"
}

使用 Intent 構造器

  • 詳細用法
val intent = Intent(this,SomeOtherActivity::class.java)
intent.putExtra("id",1000)
intent.setFlag(Intent.FLAG_ACTIVITY_SINGLE_TOP)
startActivity(intent)
  • 簡單用法

    startActivity(intentFor

    startActivity

    有用的喚醒意圖

    描述 解答
    打電話 makeCall(number)
    發信息 sendSMS(number,[text])
    瀏覽網頁 browse(url)
    分享文字 share(text,[subject])
    發送郵件 email(email,[subject],[text])

    註意:[]方括號中的參數是可選的。當intent是發送的時候,方法返回true

個人翻譯自https://github.com/Kotlin/anko/wiki/Anko-Commons-%E2%80%93-Intents,未經授權,請勿轉載。

Anko使用指南(一)之Intent