gpt4 book ai didi

android - 如何在 Kotlin 中使用 intent.setComponent

转载 作者:行者123 更新时间:2023-12-02 13:21:12 25 4
gpt4 key购买 nike

如何在 Kotlin 中使用 setComponent 编写以下代码。我是 kotlin 的新手,我可以在哪里使用 Kotlin 启动 kotlin android。

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.android.settings","com.android.settings.Settings$TestingSettingsActivity"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);

最佳答案

使用属性引用 :-

intent.component = ComponentName("com.android.settings","com.android.settings.Settings$TestingSettingsActivity")

关于android - 如何在 Kotlin 中使用 intent.setComponent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56509991/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com