java - What is the best practice for putting classes under package names in Android -
java - What is the best practice for putting classes under package names in Android -
android studio 0.8.11
hello,
i have completed test on android build app takes live news feed, , display them. however, instructor critical set classes under 1 package.
i wondering best practice packaging classes. particular test have next classes under bundle name:
com.viewsys.ncon
my classes these:
dbhelper <-- database creating , ugprading detailactivity <-- activity add together ncondetailfragment nconcontract <-- properties of database schema columns, table name ncondetailfragment <-- detail fragment nconlistfragment <-- list fragment nconviewpager <-- view pager jsonnewsfeed <-- class downloads , parses json format mainactivity <-- main activity newsfeed <-- class of properties getters/setters news feed newsfeeddb <-- simple array list store object sqlite3 db splashactivity <-- activity add together splashfragment , nconlistfragment splashfragment <-- splash fragment utilities <-- simple utility functions many suggestions,
first separate model (classes holding data) , view (everything display) , create subpackages different types of classes.
for example:
com.viewsys.ncon
utilities com.viewsys.ncon.model
nconcontract jsonnewsfeed newsfeed com.viewsys.ncon.model.db
dbhelper newsfeeddb com.viewsys.ncon.view
nconviewpager com.viewsys.ncon.view.activities
detailactivity mainactivity splashactivity com.viewsys.ncon.view.fragments
ncondetailfragment nconlistfragment splashfragment you should seek minimize bundle dependency cycling. means 1 bundle can depend on other (or multiple other) bundle , utilize classes required bundle should minimize dependency first package. dependeny calls should go 1 direction.
java android packages
Comments
Post a Comment