How to exchange data (objects) between different Android Activities?

前端 未结 4 877
暗喜
暗喜 2021-02-09 17:35

What is proper way to exchange data or objects between different Android Activities?

Welcome screen <-> Main Screen <-> Startup routines <-> Processing data <

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-09 18:15

    Is it normal/recommended to have more than one activity in Android app?

    Normal? Yes. Recommended? That depends on the app.

    in my opinion, it's somehow strange to have this model of data exchange inside application

    What do you do with Web apps? Well, you keep your model in a central spot (server) and you pass small bits of context data (URL parameters) in links between major units of UI (pages).

    What do you do with desktop apps? Well, you keep your model in a central spot (database) and you pass small bits of context data (e.g., constructor parameters) in links between major units of UI (windows).

    What do you do with Android apps? Well, you keep your model in a central spot (database, ContentProvider, etc.) and you pass small bits of context data (Intent extras) in links between major units of UI (activities).

提交回复
热议问题