startActivity(Intent(MainActivity@this, SecondActivity::class.java))
或者startActivity(Intent(this@MainActivity, SecondActivity::class.java))
或者startActivity(Intent(this, SecondActivity::class.java))
数据传递
我们使用bundle来进行数据传递
// activity携带信息,我们把数据封装到bundle中
val bundle = Bundle()
if (study != null) {
bundle.putString("web", study.web)
}
intent.putExtras(bundle)
数据获取