Anko使用指南(一)之Intent

使用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,未经授权,请勿转载。

猜你喜欢

转载自www.cnblogs.com/sixFlower/p/9283318.html