I want to go from fragment_profile to fragment_details while clicking the details button that is found in the fragment_profile. Here is the xml of the button
android:id="@+id/btn_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:onClick="onClickDetail"
app:prof_icon="@string/fa_user"
app:prof_title="Personal Info" />
Now I'm having some difficulties with the onClickDetail function because I don't know how to make the passage from fragment_profile to fragment_detail.
Here is what I've tried so far
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
btn_details.setOnClickListener(View.OnClickListener() {
fun onClickDetail(view: View?) {
val myIntent = Intent(activity, DetailFragment::class.java)
activity?.finish()
activity?.startActivity(myIntent)
}
}
)
}