Junior — Middle
What is the role of a data object in a system and in what scenarios is it used?
sobes.tech AI
Answer from AI
A Data Object in Android is a structure or class used for storing and transferring data within an application. It typically contains only fields and access methods (getters and setters), without behavior logic.
Use cases:
- Transferring data between Activities or Fragments via Intent or Bundle.
- Storing UI state.
- Modeling data received from a database or network.
For example, a user model class:
data class User(val id: Int, val name: String, val email: String)
Such an object is convenient for passing information and working with it in the application.