Skip to content

Na vu#11

Open
VuNA2k2 wants to merge 2 commits intomasterfrom
NAVu
Open

Na vu#11
VuNA2k2 wants to merge 2 commits intomasterfrom
NAVu

Conversation

@VuNA2k2
Copy link
Collaborator

@VuNA2k2 VuNA2k2 commented Jul 30, 2022

No description provided.

Copy link
Collaborator

@DuongLH-Sudo DuongLH-Sudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Em tìm hiểu xem còn cách nào giao tiếp giữa fragent với nhau và với activity
thay đổi cách navigate giũa 2 màn login và sign up
nên để tên id của view lên đầu sau dễ tìm hơn

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
activityMainBinding = ActivityLoginBinding.inflate(layoutInflater)
setContentView(activityMainBinding.root)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nếu chỉ để setContentView thì k cần phải binding

fragmentSignUpBinding.apply {
tvLogin.setOnClickListener {
requireActivity().supportFragmentManager.beginTransaction().add(R.id.fragmentState, LoginFragment()).commit()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cứ add qua add lại giũa 2 fragment v không dc
như thế backstack sẽ nhanh bị đầy gây lãng phí
tìm cách khác

bundle.putSerializable("account", user)
loginFragment.arguments = bundle
requireActivity().supportFragmentManager.beginTransaction().add(R.id.fragmentState, loginFragment).commit()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tìm cách khác giao tiếp giữa 2 fragment

fragmentLoginBinding.apply {
tvSignUp.setOnClickListener {
requireActivity().supportFragmentManager.beginTransaction().add(R.id.fragmentState, SignUpFragment()).commit()
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

có thể gọi parentFragmentmanager

<androidx.fragment.app.FragmentContainerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragmentState"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tên id nên là tên tag viết tắt + mô ta về ý nghĩa của view vd fcvAuthen

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tvQuestion"
android:text="Don't have account?"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tránh hard code như này

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants