Question: I can't get my head around how to apply the model-view-controller design pattern in an android studio project.

I understand that the view is the .xml layouts and that the activity classes are supposed to be the controllers, but I'm confused about whether general programming logic should be a part of the controller or model.

Can the programming logic related to a particular activity be included within the activity class or should they be separated into two classes? i.e. the activity handling just user input and a second class dealing with the associated programming logic.

Answer: 
It's always a good idea to isolate your code depending on the responsibilities. It's gives us several advantages when it's come to code readability and maintainability.

Since you have asked for MVC pattern but here we have a very good example of MVP pattern which is explained on the following link of Google samples regarding clean architecture in Android projects.

Link: <https://github.com/googlesamples/android-architecture/blob/todo-mvp/README.md>

![enter image description here](https://i.stack.imgur.com/QhVU2.png)

Components:

Model: More of your business entities/Pojo
Views: More of your fragments and activities
Repository: Data source for the information. It can be one of your database, cache, remote server, file system etc.
Presentor: It's a layer which get data from one of your repository and send result back to your views.

I have tried to implement similar pattern in one of my learning project.

Link: <https://github.com/amol-kamble/movie-finder/tree/master/app/src/main>
An architecture decision could be:

* Whether the application is expected to function online or offline?
* When packaging an application, how should you distribute top-level packages in the codebase?
* Dependency injection.
* Unit testing.

Architecture is our attempt to manage risks involved in changing requirements. As with any other risk-management activity, we cannot be prepared for all the possible risk that can come into play. We need to choose a subset of possible future changes that we are optimizing our application for, and this subset will constitute the application architecture.

Here is a knowledge base to get started, you should make your own project and implement these software architectures in order to adopt the one that works for you and your project:

[Android Architecture Blueprints](https://github.com/googlesamples/android-architecture)

[![Android Architecture Blueprints](https://i.stack.imgur.com/72yfM.png)](https://i.stack.imgur.com/72yfM.png)

[Reactive Apps with MODEL-VIEW-INTENT - PART1 - Model](http://hannesdorfmann.com/android/mosby3-mvi-1)

[![enter image description here](https://i.stack.imgur.com/ItwJT.gif)](https://i.stack.imgur.com/ItwJT.gif)