if (selectedPosition >= 0 && mAdapter != null && selectedPosition < mAdapter.getCount()) { View view = mRecycler.get(selectedPosition); if (view == null) {
if (selectedPosition >= 0 && mAdapter != null && selectedPosition < mAdapter.getCount()) { View view = mRecycler.get(selectedPosition); if (view == null) {
/** * Obtain a view, either by pulling an existing view from the recycler or * by getting a new one from the adapter. If we are animating, make sure * there is enough information in the view's layout parameters to animate * from the old to new positions. * * @param position Position in the spinner for the view to obtain * @return A view that has been added to the spinner */ private View makeAndAddView(int position) { View child; if (!mDataChanged) { child = mRecycler.get(position); if (child != null) { // Position the view setUpChild(child); return child; } } // Nothing found in the recycler -- ask the adapter for a view child = mAdapter.getView(position, null, this); // Position the view setUpChild(child); return child; }
/** * Obtain a view, either by pulling an existing view from the recycler or * by getting a new one from the adapter. If we are animating, make sure * there is enough information in the view's layout parameters to animate * from the old to new positions. * * @param position Position in the spinner for the view to obtain * @return A view that has been added to the spinner */ private View makeAndAddView(int position) { View child; if (!mDataChanged) { child = mRecycler.get(position); if (child != null) { // Position the view setUpChild(child); return child; } } // Nothing found in the recycler -- ask the adapter for a view child = mAdapter.getView(position, null, this); // Position the view setUpChild(child); return child; }