Activity là component độc lập chiếm toàn màn hình, quản lý vòng đời UI cho một màn hình.
- Fragment là component UI nhẹ hơn, có thể tái sử dụng, và luôn tồn tại trong một Activity — có thể swap vào/ra tùy ý.
- Fragment giúp xây dựng UI linh hoạt thích ứng với nhiều kích thước màn hình, còn Activity đại diện cho các màn hình riêng biệt trong app.
An Activity is a full-screen independent component that manages the lifecycle of UI for a screen.
- A Fragment is a reusable, lightweight UI component that always exists within an Activity and can be swapped in and out.
- Fragments allow you to build flexible UIs that adapt to different screen sizes, while activities represent distinct screens in your app.