Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.hanakpiskozub;
- import android.content.Context;
- import android.util.AttributeSet;
- import android.widget.Spinner;
- public class SpinnerM extends Spinner {
- public SpinnerM(Context context) {
- super(context);
- }
- public SpinnerM(Context context, AttributeSet attributes) {
- super(context, attributes);
- }
- @Override
- public void setSelection(int position, boolean animate) {
- boolean sameSelected = position == getSelectedItemPosition();
- super.setSelection(position, animate);
- if(sameSelected){
- getOnItemSelectedListener().onItemSelected(this, getSelectedView(),position, getSelectedItemId());
- }
- }
- @Override
- public void setSelection(int position){
- boolean sameSelected = position == getSelectedItemPosition();
- super.setSelection(position);
- if(sameSelected){
- getOnItemSelectedListener().onItemSelected(this, getSelectedView(), position, getSelectedItemId() );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement