本文整理匯總了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;
}
}