本文整理了Java中android.widget.Spinner.getOnItemSelectedListener()
方法的一些代码示例,展示了Spinner.getOnItemSelectedListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner.getOnItemSelectedListener()
方法的具体详情如下:
包路径:android.widget.Spinner
类名称: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!