I have a spinner in my Android app, and its onItemSelected() event automatically gets triggered upon entering the activity.
onItemSelected()
How do I avoid this?
You can avoid it by ignoring the first click by,
private boolean isSpinnerInitial = true; //As global variable public void onItemSelected(xxx xxx, xxx xxx, xxx xxx, xxx xxx) { if(isSpinnerInitial) { isSpinnerInitial = false; return; } // Write your code here }