Giter Club home page Giter Club logo

mymvptestdemo's Introduction

MyMVPTestDemo

android mvp设计模式 1.MVP模式中包含以下四个元素:

(1)View:负责绘制UI元素、与用户进行交互(在Android中体现为Activity);


(2)View interface:需要View实现的接口,View通过View interface与Presenter进行交互,降低耦合,方便进行单元测试;


(3)Model:负责存储、检索、操纵数据(有时也实现一个Model interface用来降低耦合);


(4)Presenter:作为View与Model交互的中间纽带,处理与用户交互的负责逻辑。

注意:1.View不直接与Model交互,而是通过与Presenter交互来与Model间接交互

  2.通常View与Presenter是一对一的,但复杂的View可能绑定多个Presenter来处理逻辑

2.写个简单MVP获取用户信息并显示的demo

功能设计:

1.view :获取用户的输入,并在点show 按键时显示出来,由此ye定义出view 接口该有什么方法

2.model :Presenter传递进来的用户数据进行存储,在调用时取出来,由此也定义出model 接口该有什么方法

3.presenter:桥梁作用,通过接口与View及Model进行交互,完成功能.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.