Bảng Điều Khiển Ôn Phỏng Vấn Android
Kotlin • MVVM • Flow • REST API • Compose • Testing
Về Lộ trình kiến thức0/6
P0 - Bắt buộc vững
XML / Compose
JD chấp nhận XML hoặc Compose. Biết cả hai và làm được list/detail với đủ trạng thái.
Khái niệm chính
- XML: ConstraintLayout, RecyclerView + ListAdapter + DiffUtil, ViewBinding.
- Compose: remember/rememberSaveable, state hoisting, recomposition.
- Không gọi API trong composable body; dùng LaunchedEffect/ViewModel.
- collectAsStateWithLifecycle để collect state an toàn.
Checklist
Tick những gì bạn đã nắm chắc
Lỗi thường gặp
- •Gọi API trực tiếp trong Composable body (recompose nhiều lần).
- •Quên DiffUtil khiến RecyclerView refresh toàn bộ list.
- •Đọc state quá cao trong cây Compose làm recomposition lan rộng.
Câu trả lời mẫu
Em không gọi API trong composable body vì nó recompose nhiều lần. Em gửi event tới ViewModel hoặc dùng `LaunchedEffect` với key phù hợp; UI chỉ collect state và render. Với XML em dùng RecyclerView + ListAdapter + DiffUtil để update mượt.
Câu hỏi liên quan