Android 如何在组合函数';s按钮点击
我想将用户重定向到另一个打开internet url的活动。按一下按钮 这是到目前为止我的代码Android 如何在组合函数';s按钮点击,android,kotlin,android-jetpack-compose,Android,Kotlin,Android Jetpack Compose,我想将用户重定向到另一个打开internet url的活动。按一下按钮 这是到目前为止我的代码 Button(onClick = { val intent = Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")) // Here is some code that starts the activity }) { Text(text
Button(onClick = {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"))
// Here is some code that starts the activity
}) {
Text(text="APPLY HACK")
}
您可以使用以下内容:
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"))
val context = LocalContext.current
Button(onClick = {
startActivity(context, intent, null) }
) {
Text("BUTTON")
}