本文整理汇总了Java中android.widget.Spinner.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Spinner.getId方法的具体用法?Java Spinner.getId怎么用?Java Spinner.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.Spinner
的用法示例。
在下文中一共展示了Spinner.getId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemSelected
import android.widget.Spinner; //导入方法依赖的package包/类
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
Spinner sp = (Spinner) parent;
int i = sp.getSelectedItemPosition();
switch (sp.getId()) {
case R.id.spnAutoHobbs:
MFBLocation.fPrefAutoFillHobbs = MFBLocation.AutoFillOptions.values()[i];
break;
case R.id.spnAutoTime:
MFBLocation.fPrefAutoFillTime = MFBLocation.AutoFillOptions.values()[i];
break;
case R.id.spnTOSpeed:
MFBTakeoffSpeed.setTakeOffSpeedIndex(i);
break;
default:
break;
}
}
示例2: onItemSelected
import android.widget.Spinner; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
Spinner spinner = (Spinner) adapterView;
switch (spinner.getId()){
case R.id.action_category:
if (i != periodIndex) {
periodIndex = i;
updateData();
}
break;
case R.id.spinner_city:
if (!adapterView.getItemAtPosition(i).toString().equals(city)){
city = adapterView.getItemAtPosition(i).toString();
updateData();
}
break;
case R.id.spinner_lang:
if (!adapterView.getItemAtPosition(i).toString().equals(language)){
language = adapterView.getItemAtPosition(i).toString();
updateData();
}
break;
case R.id.spinner_job_title:
if (!adapterView.getItemAtPosition(i).toString().equals(jobTitle)){
jobTitle = adapterView.getItemAtPosition(i).toString();
if (AppUtils.checkProgramming(jobTitle)){
langSpinner.setSelection(0);//No programming language for QA or Management
}
updateData();
}
break;
}
}