android.widget.Spinner.getOnItemSelectedListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中android.widget.Spinner.getOnItemSelectedListener()方法的一些代码示例,展示了Spinner.getOnItemSelectedListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner.getOnItemSelectedListener()方法的具体详情如下:
包路径:android.widget.Spinner
类名称:Spinner
方法名:getOnItemSelectedListener

Spinner.getOnItemSelectedListener介绍

暂无

代码示例

代码示例来源:origin: k9mail/k-9

OnItemSelectedListener onItemSelectedListener = mAuthTypeView.getOnItemSelectedListener();
mAuthTypeView.setOnItemSelectedListener(null);
mCurrentAuthTypeViewPosition = mAuthTypeAdapter.getAuthPosition(AuthType.PLAIN);

代码示例来源:origin: stackoverflow.com

private void setSpinnerSelectionWithoutCallingListener(final Spinner spinner, final int selection) {
  final OnItemSelectedListener l = spinner.getOnItemSelectedListener();
  spinner.setOnItemSelectedListener(null);
  spinner.post(new Runnable() {
    @Override
    public void run() {
      spinner.setSelection(selection);
      spinner.post(new Runnable() {
        @Override
        public void run() {
          spinner.setOnItemSelectedListener(l);
        }
      });
    }
  });
}

代码示例来源:origin: k9mail/k-9

OnItemSelectedListener onItemSelectedListener = mAuthTypeView.getOnItemSelectedListener();
mAuthTypeView.setOnItemSelectedListener(null);
mAuthTypeView.setSelection(mCurrentAuthTypeViewPosition, false);
updateViewFromAuthType();
onItemSelectedListener = mSecurityTypeView.getOnItemSelectedListener();
mSecurityTypeView.setOnItemSelectedListener(null);
mSecurityTypeView.setSelection(mCurrentSecurityTypeViewPosition, false);

代码示例来源:origin: k9mail/k-9

OnItemSelectedListener onItemSelectedListener = mAuthTypeView.getOnItemSelectedListener();
mAuthTypeView.setOnItemSelectedListener(null);
mAuthTypeView.setSelection(mCurrentAuthTypeViewPosition, false);
updateViewFromAuthType();
onItemSelectedListener = mSecurityTypeView.getOnItemSelectedListener();
mSecurityTypeView.setOnItemSelectedListener(null);
mSecurityTypeView.setSelection(mCurrentSecurityTypeViewPosition, false);

代码示例来源:origin: stackoverflow.com

private void setSelectionWithoutDispatch(Spinner spinner, int position) {
  AdapterView.OnItemSelectedListener onItemSelectedListener = spinner.getOnItemSelectedListener();
  spinner.setOnItemSelectedListener(null);
  spinner.setSelection(position, false);
  spinner.setOnItemSelectedListener(onItemSelectedListener);
}

代码示例来源:origin: cattaka/AdapterToolbox

public static void setSelection(@NonNull Spinner spinner, int position, boolean cancelListener) {
  if (cancelListener) {
    AdapterView.OnItemSelectedListener listener = spinner.getOnItemSelectedListener();
    if (listener != null) {
      spinner.setOnItemSelectedListener(null);
    }
    spinner.setSelection(position, false);
    if (listener != null) {
      spinner.setOnItemSelectedListener(listener);
    }
  } else {
    spinner.setSelection(position);
  }
}

代码示例来源:origin: Coinomi/coinomi-android

/**
 * Selects an account on the destinationSpinner without calling the callback. If no account
 * found in the adaptor, does not do anything
 */
private void setDestinationSpinner(Object accountOrType) {
  int newPosition = destinationAdapter.getAccountOrTypePosition(accountOrType);
  if (newPosition >= 0) {
    AdapterView.OnItemSelectedListener cb = destinationSpinner.getOnItemSelectedListener();
    destinationSpinner.setOnItemSelectedListener(null);
    destinationSpinner.setSelection(newPosition);
    destinationSpinner.setOnItemSelectedListener(cb);
  }
}

代码示例来源:origin: openwalletGH/openwallet-android

/**
 * Selects an account on the sourceSpinner without calling the callback. If no account found in
 * the adaptor, does not do anything
 */
private void setSourceSpinner(WalletAccount account) {
  int newPosition = sourceAdapter.getAccountOrTypePosition(account);
  if (newPosition >= 0) {
    AdapterView.OnItemSelectedListener cb = sourceSpinner.getOnItemSelectedListener();
    sourceSpinner.setOnItemSelectedListener(null);
    sourceSpinner.setSelection(newPosition);
    sourceSpinner.setOnItemSelectedListener(cb);
  }
}

代码示例来源:origin: Coinomi/coinomi-android

/**
 * Selects an account on the sourceSpinner without calling the callback. If no account found in
 * the adaptor, does not do anything
 */
private void setSourceSpinner(WalletAccount account) {
  int newPosition = sourceAdapter.getAccountOrTypePosition(account);
  if (newPosition >= 0) {
    AdapterView.OnItemSelectedListener cb = sourceSpinner.getOnItemSelectedListener();
    sourceSpinner.setOnItemSelectedListener(null);
    sourceSpinner.setSelection(newPosition);
    sourceSpinner.setOnItemSelectedListener(cb);
  }
}

代码示例来源:origin: openwalletGH/openwallet-android

/**
 * Selects an account on the destinationSpinner without calling the callback. If no account
 * found in the adaptor, does not do anything
 */
private void setDestinationSpinner(Object accountOrType) {
  int newPosition = destinationAdapter.getAccountOrTypePosition(accountOrType);
  if (newPosition >= 0) {
    AdapterView.OnItemSelectedListener cb = destinationSpinner.getOnItemSelectedListener();
    destinationSpinner.setOnItemSelectedListener(null);
    destinationSpinner.setSelection(newPosition);
    destinationSpinner.setOnItemSelectedListener(cb);
  }
}

相关文章