Source:
private void initSpinner() { serverSpinner = (Spinner) loginActivity.findViewById(R.id.server_spinner); String[] serverList = loginActivity.getResources().getStringArray(R.array.server_list); if(serverList.length<1) { return; } ArrayAdapter serversListAdapter = new ArrayAdapter<>(loginActivity.getBaseContext(),android.R.layout.simple_spinner_item, serverList); serverSpinner.setAdapter(serversListAdapter); serverSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String value = parent.getItemAtPosition(position).toString(); if(value.equals(parent.getContext().getResources().getString(R.string.production))){ showServerEditUrls(false); programURLEditText.setText(R.string.program_url_production); programEndPointEditText.setText(R.string.program_endpoint_production); webviewURLEditText.setText(R.string.web_url_production); loginActivity.getServerText().setText(R.string.webservice_url_production); } else if(value.equals(parent.getContext().getResources().getString(R.string.training))){ showServerEditUrls(false); programURLEditText.setText(R.string.program_url_training); programEndPointEditText.setText(R.string.program_endpoint_training); webviewURLEditText.setText(R.string.web_url_training); loginActivity.getServerText().setText(R.string.webservice_url_training); } else if (value.equals(parent.getContext().getResources().getString(R.string.custom))){ showServerEditUrls(true); programURLEditText.setText(R.string.program_url_production); programEndPointEditText.setText(R.string.program_endpoint_production); webviewURLEditText.setText(R.string.web_url_production); loginActivity.getServerText().setText(R.string.webservice_url_production); } } @Override public void onNothingSelected(AdapterView<?> parent) { parent.setSelection(0); } }); }

Target:
private void initSpinner() { serverSpinner = (Spinner) loginActivity.findViewById(R.id.server_spinner); String[] serverList = loginActivity.getResources().getStringArray(R.array.server_list); if(serverList.length<1) { return; } ArrayAdapter serversListAdapter = new ArrayAdapter<>(loginActivity.getBaseContext(),android.R.layout.simple_spinner_item, serverList); serverSpinner.setAdapter(serversListAdapter); serverSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String value = parent.getItemAtPosition(position).toString(); if(value.equals(parent.getContext().getResources().getString(R.string.production))){ setConfiguration(R.string.program_url_production, R.string.program_endpoint_production, R.string.web_url_production, R.string.webservice_url_production, false); } else if(value.equals(parent.getContext().getResources().getString(R.string.training))){ setConfiguration(R.string.program_url_training, R.string.program_endpoint_training, R.string.web_url_training, R.string.webservice_url_training, false); } else if (value.equals(parent.getContext().getResources().getString(R.string.custom))){ setConfiguration(R.string.program_url_production, R.string.program_endpoint_production, R.string.web_url_production, R.string.webservice_url_production, true); } } @Override public void onNothingSelected(AdapterView<?> parent) { parent.setSelection(0); } }); }