why android uses inner classes so much? -


this general question. in examples of android find adapters, tasks or else inner class. best practice in android?

i know make easier handle ui changes, on other site makes large files.

is there rules in android encapsulate in seperate files or include inner class?

thanks lot.

its not android java

from java oracle docs:

why use nested classes?

there several compelling reasons using nested classes, among them:

it way of logically grouping classes used in 1 place.

it increases encapsulation.

nested classes can lead more readable , maintainable code.

logical grouping of classes—if class useful 1 other class, logical embed in class , keep 2 together. nesting such "helper classes" makes package more streamlined.

increased encapsulation—consider 2 top-level classes, , b, b needs access members of otherwise declared private. hiding class b within class a, a's members can declared private , b can access them. in addition, b can hidden outside world.

more readable, maintainable code—nesting small classes within top-level classes places code closer used.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -