Its because getView
is called when your listView
is inflating layout... And onClick
is called when your view (move)
is pressed... At that time when its onClick is triggered, the variable position
in getView
is destroyed already... By making it final you ensure that the value of position
is preserved for later use