[英]Unable to move from activity to fragment
You can't.你不能。 You can either move from activity to activity or fragment to fragment.您可以从一个活动移动到另一个活动,也可以从一个片段移动到另一个片段。 In the first case you can use the code you have implemented with在第一种情况下,您可以使用已实现的代码
private fun onClickListener() {
profileImageView.setOnClickListener {
val i = Intent(this, SecondActivityWhatever::class.java)
startActivity(i)
}
} }
otherwise you need to implement Navigation Component in order to move from fragment to fragment.否则你需要实现导航组件才能从一个片段移动到另一个片段。
(Another option in your specific case would be using a Custom Fragment Dialog to show the profile) (您的特定情况下的另一个选项是使用自定义片段对话框来显示配置文件)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.