* 같은 어플리케이션 내 intent 사용과 동일
<activity
android:name=".MainActivity"
android:exported="true" >
<intent-filter>
<action android:name="com.test.android_startactivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
다른 애플리케이션의 activity에서 지정한 intent filter의 action name 이름으로 Intent 생성
val newIntent = Intent("com.test.android_startactivity")
newIntent.putExtra("data1", 100)
newIntent.putExtra("data2", "데이터2")
startActivity(newIntent)
val c1 = ActivityResultContracts.StartActivityForResult()
val activityLauncher = registerForActivityResult(c1) {
val value1 = it.data?.getIntExtra("value1",0)
val value2 = it.data?.getStringExtra("value2")
}
val newIntent = Intent("com.test.android_startactivity")
newIntent.putExtra("data1", 100)
newIntent.putExtra("data2", "데이터2")
activityLauncher.launch(newIntent)
안드로이드에서 제공되는 기본 어플리케이션을 사용할 수 있도록 제공
val address = "geo:37.243243,131.861601"
val uri = Uri.parse(address)
val newIntent = Intent(Intent.ACTION_VIEW, uri)
startActivity(newIntent)
val address = "http://developer.android.com"
val uri = Uri.parse(address)
val newIntent = Intent(Intent.ACTION_VIEW, uri)
startActivity(newIntent)