Java android 模型视图演示者/控制器示例

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4320141/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 15:50:15  来源:igfitidea点击:

android model view presenter/controller examples

javaandroidmodel-view-controllerdesign-patternsmvp

提问by solrevdev

are there any good examples or tutorials on how best to structure an android applications anywhere?

有没有关于如何最好地在任何地方构建 android 应用程序的好例子或教程?

am new to java and android and i've built winforms apps using passive and supervising controller variants of model view presenter and model view controller in asp.net but not really seen any examples or code on android that use these sorts of patterns.

我是 java 和 android 的新手,我已经在 asp.net 中使用模型视图展示器和模型视图控制器的被动和监督控制器变体构建了 winforms 应用程序,但在 android 上并没有真正看到任何使用这些类型模式的示例或代码。

how do people structure decent size android apps out there in the wild. are there any best practices or should i be sticking rigidly to official android documentation.

人们如何在野外构建体面大小的 android 应用程序。是否有任何最佳实践,或者我应该严格遵守官方 android 文档。

回答by Mohit Deshpande

Check out the Android Developers page. There you will find the answers to all of your questions. And MVC is already present in Android. Check out this question. The videos herecan explain what you're looking for.

查看Android 开发人员页面。在那里您会找到所有问题的答案。MVC 已经存在于 Android 中。看看这个问题此处的视频可以解释您要查找的内容。

回答by Julian Suarez

Also Mosbyimplements an MVP pattern plus other things, but it is modular enough so that you can use only the MVP part and forget about the rest.

Mosby还实现了 MVP 模式和其他东西,但它足够模块化,因此您可以只使用 MVP 部分而忘记其余部分。

There is also a nice blog post covering the motivations and choices of this library

还有一篇很好的博客文章介绍了这个的动机和选择

回答by Ajit Singh

I created an application to manage my expenses. It is built using MVP pattern. I have explained it in this post.

我创建了一个应用程序来管理我的开支。它是使用 MVP 模式构建的。我已经在这篇文章中解释过了。