Android MVVM Design Pattern Examples

后端 未结 14 1225
逝去的感伤
逝去的感伤 2020-12-07 07:09

I currently do a lot of WPF development and have started creating some basic Android apps. When creating WPF apps I often use MVVM, normally using Prism, and would like to k

相关标签:
14条回答
  • 2020-12-07 07:52

    Android-Data-Binding library is a tool for connecting data to user interface elements. Once the layout file created and each item is tagged, one line of code binds all the data to user interface elements and saves your time for other tasks.

    0 讨论(0)
  • 2020-12-07 07:52

    There are plenty of examples for MVVM framework in github. I recommend using DroidWizard

    DroidWizard does its own coupling between view and view model and the framework is slightly different from mvvm.

    ModelEngine ViewModel View instean of Model ViewModel View

    0 讨论(0)
  • 2020-12-07 07:53

    I am the developer of Android-Binding. Like @Brentley said, it's a very new project but I do hope to get more buzz and experience so that it can be improved. Back to your question, I have written some simple introduction/tutorials on MVVM with android-binding:

    • Android MVVM Tutorials (with android binding)
    • Introduction to Android Binding (codeproject)
    • Model Validation in Android Binding (codeproject)
    • Wiki in project homepage

    Potential adopters please also register on the project discussion group.

    0 讨论(0)
  • 2020-12-07 07:53

    Just to post as a reference to other people who may be interested. I am a contributor to RoboBinding - A data-binding Presentation Model framework for the Android platform. It is another framework for the same purpose. Apart from helping with project structure, one major focus for RoboBinding is to make testing android apps with normal JUnit tests possible instead of Android unit tests, as Unit tests are so important to guarantee the quality of projects, but Android unit tests take ages to run and make unit tests somewhat impractical. RoboBinding itself comes with more than 300 JUnit tests to ensure its quality. MVVM originated from Microsoft as a specialization of the Presentation Model design pattern introduced by Martin Fowler. Other alternatives: Android-Binding, Bindroid and MvvmCross.

    0 讨论(0)
  • 2020-12-07 07:54

    There is now an Official Android Data Binding Plugin although its still in beta at the moment. Work is also being done to add tooling support for the binding syntax in the beta version of Android Studio.

    See below for more information

    https://developer.android.com/tools/data-binding/guide.html

    0 讨论(0)
  • 2020-12-07 07:54

    There is a relatively new framework being developed that allows for Views to be bound to ViewModels called android-binding. Using this framework and RoboGuice you can get your MVVM on. The framework still needs some work, but it's a good starting point.

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