MVC design pattern for android app development by using Fragments as Views and Activity as Controller

前端 未结 1 1689
Happy的楠姐
Happy的楠姐 2021-02-13 02:01

I was recently reading Fragments( haven\'t used this in my app though) and learnt that it can be used in phones app development.

I am thinking about using Fragments to

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-13 02:53

    IMHO, fragments are the controller. The fragment's basket of widgets represents the view. Activities are an orchestration layer, determining what fragments (and their widgets) are needed in a given circumstance (e.g., one on a phone, two on a tablet) but otherwise having limited business logic.

    That being said, Android and patterns like MVC don't necessarily go together. I don't think that Google's intention was to create a pure MVC framework.

    0 讨论(0)
提交回复
热议问题