本文整理了Java中android.widget.Spinner.getSelectedItemId()
方法的一些代码示例,展示了Spinner.getSelectedItemId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner.getSelectedItemId()
方法的具体详情如下:
包路径:android.widget.Spinner
类名称:Spinner
方法名:getSelectedItemId
暂无
代码示例来源:origin: dsolonenko/financisto
private long getSelectedAccountId() {
return accountSpinner.getSelectedItemId();
}
代码示例来源:origin: limboemu/limbo
private void triggerUpdateSpinner(final Spinner spinner) {
final int position = (int) spinner.getSelectedItemId();
spinner.setSelection(0);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
spinner.setSelection(position);
}
}, 100);
}
代码示例来源:origin: dsolonenko/financisto
@Override
protected void addItem() {
long fromCurrencyId = fromCurrencySpinner.getSelectedItemId();
long toCurrencyId = toCurrencySpinner.getSelectedItemId();
if (fromCurrencyId > 0 && toCurrencyId > 0) {
Intent intent = new Intent(this, ExchangeRateActivity.class);
intent.putExtra(ExchangeRateActivity.FROM_CURRENCY_ID, fromCurrencyId);
intent.putExtra(ExchangeRateActivity.TO_CURRENCY_ID, toCurrencyId);
startActivityForResult(intent, ADD_RATE);
}
}
代码示例来源:origin: dsolonenko/financisto
private void updateSmsTemplateFromUI() {
smsTemplate.title = smsNumber.getText().toString();
smsTemplate.template = templateTxt.getText().toString();
smsTemplate.categoryId = categorySelector == null ? categoryId : categorySelector.getSelectedCategoryId();
smsTemplate.isIncome = toggleIncome.isChecked();
smsTemplate.accountId = accountSpinner.getSelectedItemId();
}
代码示例来源:origin: dsolonenko/financisto
@Override
protected void updateResultIntentFromUi(Intent data) {
Spinner currencySpinner = (Spinner)findViewById(R.id.spinnerCurrency);
Spinner dateFormats = (Spinner)findViewById(R.id.spinnerDateFormats);
data.putExtra(QIF_IMPORT_DATE_FORMAT, dateFormats.getSelectedItemPosition());
data.putExtra(QIF_IMPORT_FILENAME, edFilename.getText().toString());
data.putExtra(QIF_IMPORT_CURRENCY, currencySpinner.getSelectedItemId());
}
代码示例来源:origin: dsolonenko/financisto
@Override
protected void savePreferences() {
SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();
Spinner dateFormats = (Spinner) findViewById(R.id.spinnerDateFormats);
Spinner currencySpinner = (Spinner)findViewById(R.id.spinnerCurrency);
editor.putInt(QIF_IMPORT_DATE_FORMAT, dateFormats.getSelectedItemPosition());
editor.putString(QIF_IMPORT_FILENAME, edFilename.getText().toString());
editor.putLong(QIF_IMPORT_CURRENCY, currencySpinner.getSelectedItemId());
editor.apply();
}
代码示例来源:origin: openmrs/openmrs-contrib-android-client
/**
* Get length of mLocation and check whatever it's empty or not.
* @return True if a location is selected or no location needed for the OpenMRS instance used.
*/
private boolean validateLocation(){
if(mLocation.getAdapter().getCount() > 0){
return mLocation.getSelectedItemId() != 0;
}
return true;
}
代码示例来源:origin: okleine/spitfirefox
private BlockSize getBlock1Size() {
long block1Szx= ((Spinner) activity.findViewById(R.id.spn_block1)).getSelectedItemId() - 1;
return BlockSize.getBlockSize(block1Szx);
}
代码示例来源:origin: okleine/spitfirefox
private BlockSize getBlock2Size() {
long block2Szx= ((Spinner) activity.findViewById(R.id.spn_block2)).getSelectedItemId() - 1;
return BlockSize.getBlockSize(block2Szx);
}
代码示例来源:origin: okleine/spitfirefox
private BlockSize getBlock2Size() {
long block2Szx= ((Spinner) activity.findViewById(R.id.spn_block2)).getSelectedItemId() - 1;
return BlockSize.getBlockSize(block2Szx);
}
代码示例来源:origin: demantz/RFAnalyzer
long categoryId = sp_category.getSelectedItemId();
代码示例来源:origin: stackoverflow.com
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "your selected id is " + spinner.getSelectedItemId(), Toast.LENGTH_LONG).show();
代码示例来源:origin: stackoverflow.com
String bookName = BookResults[(int)books.getSelectedItemId()][0];
String bookId = BookResults[(int)books.getSelectedItemId()][1];
代码示例来源:origin: schaal/ocreader
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
ManageFeedsActivity activity = (ManageFeedsActivity) getActivity();
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
final FragmentAddNewFeedBinding binding = FragmentAddNewFeedBinding.inflate(activity.getLayoutInflater());
final Bundle arguments = getArguments();
final long feedId = arguments.getLong(ARG_FEED_ID, -1);
final boolean newFeed = feedId < 0;
builder.setTitle(newFeed ? R.string.add_new_feed : R.string.edit_feed);
binding.feedUrl.setEnabled(newFeed);
final boolean finishAfterClose;
binding.folder.setAdapter(activity.getFolderSpinnerAdapter());
binding.feedUrl.setText(arguments.getString(ARG_URL));
binding.folder.setSelection(activity.getFolderSpinnerAdapter().getPosition(arguments.getLong(ARG_FOLDER_ID, 0)));
finishAfterClose = arguments.getBoolean(ARG_FINISH_AFTER_CLOSE, false);
builder.setPositiveButton(newFeed ? R.string.add : R.string.save, (dialogInterface, i) -> {
if(listener != null) {
if(newFeed)
listener.addNewFeed(binding.feedUrl.getText().toString(), binding.folder.getSelectedItemId(), finishAfterClose);
else
listener.changeFeed(feedId, binding.folder.getSelectedItemId());
}
});
builder.setView(binding.getRoot());
return builder.create();
}
代码示例来源:origin: tiandawu/IotXmpp
speed = getSpeedData[(int) mSpeed.getSelectedItemId()];
代码示例来源:origin: okleine/spitfirefox
@Override
public void onSendButtonClicked() {
this.hideKeyboard();
long method = ((Spinner) findViewById(R.id.spn_methods)).getSelectedItemId();
if(method == DISCOVER){
new ServiceDiscoveryTask(this).execute();
} else if(method == PING) {
new SendPingTask(this).execute();
} else {
new SendRequestTask(this).execute(method);
}
}
代码示例来源:origin: AppLozic/Applozic-Android-SDK
messageToSend.setType(sendType.getSelectedItemId() == 1 ? Message.MessageType.MT_OUTBOX.getValue() : Message.MessageType.OUTBOX.getValue());
messageToSend.setTimeToLive(getTimeToLive());
messageToSend.setMessage(message);
代码示例来源:origin: nbenm/ImapNote2
private void updateAccountSpinner () {
this.spinnerList.notifyDataSetChanged();
//this.accountSpinner.setSelection(spinnerList.getPosition(currentAccountname));
if (this.accountSpinner.getSelectedItemId() == android.widget.AdapterView.INVALID_ROW_ID) {
this.accountSpinner.setSelection(0);
}
if (Listactivity.currentList.size() == 1) {
Account account = Listactivity.accounts[0];
Listactivity.imapNotes2Account.SetUsername(Listactivity.accountManager.getUserData (account, "username"));
String pwd = Listactivity.accountManager.getPassword(account);
Listactivity.imapNotes2Account.SetPassword(pwd);
Listactivity.imapNotes2Account.SetServer(Listactivity.accountManager.getUserData (account, "server"));
Listactivity.imapNotes2Account.SetPortnum(Listactivity.accountManager.getUserData (account, "portnum"));
Listactivity.imapNotes2Account.SetSecurity(Listactivity.accountManager.getUserData (account, "security"));
Listactivity.imapNotes2Account.SetUsesticky(accountManager.getUserData (account, "usesticky"));
Listactivity.imapNotes2Account.SetSyncinterval(Listactivity.accountManager.getUserData (account, "syncinterval"));
Listactivity.imapNotes2Account.SetaccountHasChanged();
}
}
代码示例来源:origin: AppLozic/Applozic-Android-SDK
messageToSend.setType(sendType.getSelectedItemId() == 1 ? Message.MessageType.MT_OUTBOX.getValue() : Message.MessageType.OUTBOX.getValue());
messageToSend.setTimeToLive(getTimeToLive());
messageToSend.setMessage(message);
代码示例来源:origin: AppLozic/Applozic-Android-SDK
messageToForward.setType(sendType.getSelectedItemId() == 1 ? Message.MessageType.MT_OUTBOX.getValue() : Message.MessageType.OUTBOX.getValue());
messageToForward.setTimeToLive(getTimeToLive());
messageToForward.setSentToServer(false);
内容来源于网络,如有侵权,请联系作者删除!