How to classify different java files in Android according to their functions, such as activity adapter beans, etc.
我想大声告诉你
2017-05-16 13:24:13
How to classify different java files according to their functions in Android, such as dividing them into activity adapter beans, etc.
I am configuring the page activity, config, network http tool, utils, etc. I feel that the classification is to make it clearer in the future. As long as you can distinguish it clearly, it will be more clear to others.
Subcontracting can be flexibly classified according to your own needs:
Can be divided by function: Android open source project subcontracting method learning (eoe, oschina, github);
Can also be divided by business: android-architecture.
It is clearer to divide according to MVP framework and functional modules
Relatively small projects can be divided like this, a typical MVC model. Larger projects need to be divided by modules, refer to MVP or MVVM
The more you write code, the more you will pay attention to it, and you will slowly develop your own style.
I have a way, that is, look at your class inheritance relationship. For example, the MainActivity extends Activity we wrote ourselves can be classified into the Activity category; XXXAdapter extends BaseAdapter can also be classified into the Adapter category. To put it simply, it means grouping things that have something in common into one category.