I have an ArrayAdapter<String> Constructor inside of my Activitys onCreate. My problem is that each time the onCreate method of the Activity that contains the ArrayAdapter Constructer is called, the ArrayAdapter appends items to the items in the previous onCreate call, thus the same items are duplicated every time the onCreate method is called.
An example would be:
1st call to Activity - ArrayAdapter = blue, black, brown
2nd call to Activity - ArrayAdapter = blue, black, brown, blue, black, brown
3rd call to Activity - ArrayAdapter = blue, black, brown, blue, black, brown, blue, black, brown
My Constructor looks like this
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.adapter,colors);
Basically, I need the ArrayAdapter to remain constant on multiple calls to the Activity's onCreate.
colors?Activityis destroyed, then clearcolorsat theonDestroy(). That will solve the problem!