android - Java static modifier query -
if declared class static , it's content static mean contents of class no longer static?
here's happened, used viewholder in custom adapter in android.
when code this:
static class viewholder { static textview blah; //more widgets }
the listview had repetitive data , rows shuffled on scroll.
however, when did this, no duplicates created. there 1 instance of each list item created , items didn't shuffle on scroll.
static class viewholder { public textview blah; //more widgets }
now, know public
default access specifer , did not have change. double static cancel each other out? double negative positive?
the static modifier on class makes sense if inner class. static inner class implies instance of inner class can exist independently without instance of outer class.
the static modifier on member variable implies there 1 copy of variable instances of enclosing class.
so, there no effect of static modifier on class on static modifier on member variable.
Comments
Post a Comment