Conversation
Sudo248
left a comment
There was a problem hiding this comment.
Check lại code, có thể phản hồi bằng cách cmt bên dưới mỗi cmt của anh.
| //setContentView(R.layout.activity_login) | ||
|
|
||
| binding = ActivityLoginBinding.inflate(layoutInflater) | ||
| setContentView(binding.root) |
There was a problem hiding this comment.
Không cần thiết phải dùng bingding nếu đơn giản chỉ cần set view
|
|
||
| binding.tvBtnLogOut.setOnClickListener { | ||
| finish() | ||
| } |
There was a problem hiding this comment.
Nên tách hàm riêng, có thể dùng with(binding) hoặc binding.apply
| android:layout_weight="0.4" /> | ||
|
|
||
| <androidx.appcompat.widget.AppCompatButton | ||
| android:id="@+id/tv_btn_logOut" |
There was a problem hiding this comment.
tại là em custome cái textview thành thực hiện chức năng như 1 button nên em nghĩ là ký hiệu kiểu đó sẽ tường mình hơn ạ ;-;, nếu trong trường hợp custom như vậy thì nên đặt là gì ạ anh?
There was a problem hiding this comment.
<androidx.appcompat.widget.AppCompatButton> em dùng cái này thì id phải là btnLogOut
|
|
||
| </androidx.constraintlayout.widget.ConstraintLayout> | ||
|
|
||
| </LinearLayout> No newline at end of file |
There was a problem hiding this comment.
check lại các id và cách bố trí layout
chia sẻ dữ liệu các user giữa 2 Fragment và LoginActivity bằng ViewModel
Sudo248
left a comment
There was a problem hiding this comment.
Em nên chọn 1 convention đặt tên id view cho mình thôi đừng dùng lẫn lộn cả 2.
|
|
||
| class LoginActivity : AppCompatActivity(), LogInFragment.GetUsersListListener, | ||
| SignUpFragment.UpdateUsersListListener { | ||
| private val loginModel: LoginModel by viewModels() |
|
|
||
| startActivity(intent) | ||
|
|
||
| activity?.finish() |
There was a problem hiding this comment.
Biết dùng activity để finish mà k biết biết dùng activity để lấy dữ liệu từ activity cha à?
| import androidx.lifecycle.ViewModel | ||
| import com.sudo.androidd20.data.User | ||
|
|
||
| class LoginModel : ViewModel() { |
There was a problem hiding this comment.
Kế thừa ViewModel nhưng lại đặt tên là Model??
No description provided.