Code example for SpinnerAdapter

Methods: getCount

0
 
	private void setupButtons() { 
		if (mAdapter != null) {
			boolean enabled = mIndex > 0;
			mDecreaseButton.setEnabled(enabled);
			enabled = mIndex + 1 < mAdapter.getCount();
			mIncreaseButton.setEnabled(enabled);
		} 
	} 
 
	public void setSelection(int index, boolean animate) {
		if (index == mIndex) {
			return; 
		} 
		int endPosition = index * mSize;
		int diff = Math.abs(index - mIndex);
		int sign = index > mIndex? 1 : -1;
		mIndex = index;
		if (diff > 1) {
			mPosition = endPosition - sign * mSize;
		}