B
B
babaevmm2016-04-27 10:36:00
Android
babaevmm, 2016-04-27 10:36:00

Should I use the MVP pattern in Android development?

Hello!
I've been learning Android programming for a couple of months. The development environment is Android Studio. From the very beginning, I noticed that "standard" programming in this area implies the separation of the model-controller-view reflected into the model-activity (fragment) -layout. Which, in principle, is "good" for me, since until now I have been programming in C # for WPF (MVVM) and ASP.NET (MVC). But recently, I often came across articles about the use of the MVP pattern.
Questions:
1) What is the difference between the standard structure and MVP?
2) What will be the gain in using MVP?
3) If its use is desirable, then what resources with good examples of how to use it in Android should be consulted?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AleksandrFl, 2020-09-14
@AleksandrFl

below is a simple working example of an application with the viewPager2 library + mvp moxy
href= https://yadi.sk/d/LhmZqokWi0uaQQ?w=1

@InjectPresenter
    lateinit var mainPresenter: MainPresenter

    @ProvidePresenter
    internal fun provideSettingsPresenter(): MainPresenter {
        return MainPresenter()
    }

override fun showDialog() {
        //TODO("Not yet implemented")
        Toast.makeText(this, "sdfgvsdfgv", Toast.LENGTH_LONG)
        alertDialog = AlertDialog.Builder(this)
            .setTitle("Title")
            .setMessage("Message")
            .setOnDismissListener { mainPresenter.onHideDialog() }
            .show()
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question