I have a spinner that returns the cities saved in my DB, when this city does not exist, I allow to register the same, and after registering and saving, I have to close the city cadastre activity and return to the previous one that would be the activity that contains the spinner, but this city that has just been saved, does not appear in my spinner, I have to leave the app and come back on it again so I can update this information. How do I update the spinner data at run time, so that is how I return to the activity that contains the spinner? Here's my spinner:
List<String> labels = ds.getAllLabels();
spin = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item,labels);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spin.setAdapter(dataAdapter);