当前位置: 首页>>代码示例>>Java>>正文


Java Spinner.getSelectedItemPosition方法代码示例

本文整理汇总了Java中android.widget.Spinner.getSelectedItemPosition方法的典型用法代码示例。如果您正苦于以下问题:Java Spinner.getSelectedItemPosition方法的具体用法?Java Spinner.getSelectedItemPosition怎么用?Java Spinner.getSelectedItemPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.Spinner的用法示例。


在下文中一共展示了Spinner.getSelectedItemPosition方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
    }
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:18,代码来源:ActOptions.java

示例2: refreshCollections

import android.widget.Spinner; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void refreshCollections() {
	ArrayAdapter<TGSelectableItem> arrayAdapter = new ArrayAdapter<TGSelectableItem>(findActivity(), R.layout.view_browser_spinner_item, createCollectionValues());
	arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	
	TGSelectableItem selectedItem = new TGSelectableItem(findCurrentCollection(), null);
	Integer selectedItemPosition = arrayAdapter.getPosition(selectedItem);
	
	Spinner spinner = (Spinner) this.findViewById(R.id.browser_collections);
	OnItemSelectedListener listener = spinner.getOnItemSelectedListener();
	spinner.setOnItemSelectedListener(null);
	if(!this.isSameCollection(arrayAdapter, (ArrayAdapter<TGSelectableItem>) spinner.getAdapter())) {
		spinner.setAdapter(arrayAdapter);
	}
	if( spinner.getSelectedItemPosition() != selectedItemPosition ) {
		spinner.setSelection(selectedItemPosition, false);
	}
	spinner.setOnItemSelectedListener(listener);
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:20,代码来源:TGBrowserView.java

示例3: startClick

import android.widget.Spinner; //导入方法依赖的package包/类
public void startClick(View v) {
    TestParams params = new TestParams();
    Spinner spinnerThread = (Spinner) findViewById(R.id.spinnerThread);
    String threadModeStr = spinnerThread.getSelectedItem().toString();
    ThreadMode threadMode = ThreadMode.valueOf(threadModeStr);
    params.setThreadMode(threadMode);

    params.setEventInheritance(((CheckBox) findViewById(R.id.checkBoxEventBusEventHierarchy)).isChecked());
    params.setIgnoreGeneratedIndex(((CheckBox) findViewById(R.id.checkBoxEventBusIgnoreGeneratedIndex)).isChecked());

    EditText editTextEvent = (EditText) findViewById(R.id.editTextEvent);
    params.setEventCount(Integer.parseInt(editTextEvent.getText().toString()));

    EditText editTextSubscriber = (EditText) findViewById(R.id.editTextSubscribe);
    params.setSubscriberCount(Integer.parseInt(editTextSubscriber.getText().toString()));

    Spinner spinnerTestToRun = (Spinner) findViewById(R.id.spinnerTestToRun);
    int testPos = spinnerTestToRun.getSelectedItemPosition();
    params.setTestNumber(testPos + 1);
    ArrayList<Class<? extends Test>> testClasses = initTestClasses(testPos);
    params.setTestClasses(testClasses);

    Intent intent = new Intent();
    intent.setClass(this, TestRunnerActivity.class);
    intent.putExtra("params", params);
    startActivity(intent);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:TestSetupActivity.java

示例4: categoryButtonListener

import android.widget.Spinner; //导入方法依赖的package包/类
public void categoryButtonListener(View v) {
    Spinner categorySpinner = (Spinner) findViewById(R.id.category_spinner);
    TextView categoryValidation = (TextView) findViewById(R.id.category_validation);
    if (categorySpinner.getSelectedItemPosition() == categorySpinner.getCount()) {
        categoryValidation.setVisibility(View.VISIBLE);
    } else {
        categoryValidation.setVisibility(View.INVISIBLE);
        int categoryId =
                ((Spinner) findViewById(R.id.category_spinner)).getSelectedItemPosition();
        mCategory = Category.values()[categoryId];
        nextPage();
    }
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:14,代码来源:CreateIssueActivity.java

示例5: onItemSelected

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
    Spinner spinner = (Spinner) parent;
    mSelectedMovie = spinner.getSelectedItemPosition();

    Log.d(TAG, "onItemSelected: " + mSelectedMovie + " '" + mMovieFiles[mSelectedMovie] + "'");
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:8,代码来源:PlayMovieActivity.java

示例6: onItemSelected

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
    Spinner spinner = (Spinner) parent;
    final int filterNum = spinner.getSelectedItemPosition();

    Log.d(TAG, "onItemSelected: " + filterNum);
    mGLView.queueEvent(new Runnable() {
        @Override public void run() {
            // notify the renderer that we want to change the encoder's state
            mRenderer.changeFilterMode(filterNum);
        }
    });
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:14,代码来源:CameraCaptureActivity.java

示例7: onItemSelected

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
    Spinner spinner = (Spinner) parent;
    final int selIndex = spinner.getSelectedItemPosition();
    boolean updated = false;

    if (parent.getId() == R.id.scheduledSwapUpdate_spinner) {
        if (mUpdatePatternIndex != selIndex) {
            Log.d(TAG, "onItemSelected [update-rate]: " + selIndex);
            mUpdatePatternIndex = selIndex;
            updated = true;
        }
    } else if (parent.getId() == R.id.scheduledSwapAhead_spinner) {
        if (mFramesAheadIndex != selIndex) {
            Log.d(TAG, "onItemSelected [frames-ahead]: " + selIndex);
            mFramesAheadIndex = selIndex;
            updated = true;
        }
    } else {
        throw new RuntimeException("Unknown spinner");
    }

    if (mRenderThread == null) {
        // huh
        Log.d(TAG, "In onItemSelected while the activity is paused");
    } else if (updated) {
        RenderHandler rh = mRenderThread.getHandler();
        if (rh != null) {
            rh.sendSetParameters(mUpdatePatternIndex, mFramesAheadIndex);
        }
    }
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:33,代码来源:ScheduledSwapActivity.java

示例8: getNumberType

import android.widget.Spinner; //导入方法依赖的package包/类
private int getNumberType(View row) {
    Spinner numberTypeSpinner = (Spinner) row.findViewById(R.id.spinner_number_type);
    switch (numberTypeSpinner.getSelectedItemPosition()) {
        case 1:
            return ContactNumber.TYPE_CONTAINS;
        case 2:
            return ContactNumber.TYPE_STARTS;
        case 3:
            return ContactNumber.TYPE_ENDS;
    }

    return ContactNumber.TYPE_EQUALS;
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:14,代码来源:AddOrEditContactFragment.java

示例9: onItemSelected

import android.widget.Spinner; //导入方法依赖的package包/类
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
                           long arg3) {
    saveLastTail();
    Spinner sp = (Spinner) findViewById(R.id.spnAircraftType);
    m_ac.InstanceTypeID = sp.getSelectedItemPosition() + 1;
    toView();
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:8,代码来源:ActNewAircraft.java

示例10: putPref

import android.widget.Spinner; //导入方法依赖的package包/类
private void putPref(SharedPreferences.Editor prefsEditor, Spinner spinner, int id, String key) {
    int position = spinner.getSelectedItemPosition();
    String selectedString = getResources().obtainTypedArray(id).getString(position);
    // Save to preferences the value selected in the spinner
    prefsEditor.putString(key, selectedString);
}
 
开发者ID:dftec-es,项目名称:planetcon,代码行数:7,代码来源:StartActivity.java

示例11: doInBackground

import android.widget.Spinner; //导入方法依赖的package包/类
@Override
protected Throwable doInBackground(String... params) {
	// Get wakelock
	PowerManager pm = (PowerManager) ActivityShare.this.getSystemService(Context.POWER_SERVICE);
	PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "XPrivacy.Toggle");
	wl.acquire();
	try {
		// Get data
		mProgressCurrent = 0;
		List<Integer> lstUid = mAppAdapter.getListUid();
		final String restrictionName = params[0];
		int actionId = ((RadioGroup) ActivityShare.this.findViewById(R.id.rgToggle)).getCheckedRadioButtonId();
		Spinner spTemplate = ((Spinner) ActivityShare.this.findViewById(R.id.spTemplate));
		String templateName = Meta.cTypeTemplate;
		if (spTemplate.getSelectedItemPosition() > 0)
			templateName = Meta.cTypeTemplate + spTemplate.getSelectedItemPosition();

		for (Integer uid : lstUid)
			try {
				if (mAbort)
					throw new AbortException(ActivityShare.this);

				// Update progess
				publishProgress(++mProgressCurrent, lstUid.size() + 1);
				setState(uid, STATE_RUNNING, null);

				List<Boolean> oldState = PrivacyManager.getRestartStates(uid, restrictionName);

				if (actionId == R.id.rbClear) {
					PrivacyManager.deleteRestrictions(uid, restrictionName, (restrictionName == null));
					if (restrictionName == null) {
						PrivacyManager.deleteUsage(uid);
						PrivacyManager.deleteSettings(uid);
					}
				}

				else if (actionId == R.id.rbRestrict) {
					PrivacyManager.setRestriction(uid, restrictionName, null, true, false);
					PrivacyManager.updateState(uid);
				}

				else if (actionId == R.id.rbTemplateCategory)
					PrivacyManager.applyTemplate(uid, templateName, restrictionName, false, true, false);

				else if (actionId == R.id.rbTemplateFull)
					PrivacyManager.applyTemplate(uid, templateName, restrictionName, true, true, false);

				else if (actionId == R.id.rbTemplateMergeSet)
					PrivacyManager.applyTemplate(uid, templateName, restrictionName, true, false, false);

				else if (actionId == R.id.rbTemplateMergeReset)
					PrivacyManager.applyTemplate(uid, templateName, restrictionName, true, false, true);

				else if (actionId == R.id.rbEnableOndemand) {
					PrivacyManager.setSetting(uid, PrivacyManager.cSettingOnDemand, Boolean.toString(true));
					PrivacyManager.setSetting(uid, PrivacyManager.cSettingNotify, Boolean.toString(false));

				} else if (actionId == R.id.rbDisableOndemand) {
					PrivacyManager.setSetting(uid, PrivacyManager.cSettingOnDemand, Boolean.toString(false));
					PrivacyManager.setSetting(uid, PrivacyManager.cSettingNotify, Boolean.toString(true));

				} else
					Util.log(null, Log.ERROR, "Unknown action=" + actionId);

				List<Boolean> newState = PrivacyManager.getRestartStates(uid, restrictionName);

				setState(uid, STATE_SUCCESS, !newState.equals(oldState) ? getString(R.string.msg_restart)
						: null);
			} catch (Throwable ex) {
				setState(uid, STATE_FAILURE, ex.getMessage());
				return ex;
			}
	} finally {
		wl.release();
	}

	return null;
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:79,代码来源:ActivityShare.java


注:本文中的android.widget.Spinner.getSelectedItemPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。