Skip to content

Instantly share code, notes, and snippets.

@florian-do
Last active July 29, 2016 13:10
Show Gist options
  • Save florian-do/4bba47085946476b3e066aa0abec025d to your computer and use it in GitHub Desktop.
Save florian-do/4bba47085946476b3e066aa0abec025d to your computer and use it in GitHub Desktop.
OnChangeListener Spinner
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
/**
* Created by do_f on 20/06/16.
*/
public abstract class CustomOnItemSelectedListener implements AdapterView.OnItemSelectedListener {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
changeListener(parent.getItemAtPosition(position).toString());
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
abstract public void changeListener(String name);
}
type.setOnItemSelectedListener(new CustomOnItemSelectedListener() {
@Override
public void changeListener(String name) {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment