Last active
July 29, 2016 13:10
-
-
Save florian-do/4bba47085946476b3e066aa0abec025d to your computer and use it in GitHub Desktop.
OnChangeListener Spinner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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