Code example for AdapterView.OnItemSelectedListener

Methods: onItemSelected

0
						int realSelectedItemPosition = viewPlayAdapter.getRealSelectedItemPosition(position);		//获取真实的位置,
						if(viewPlayIndicator != null){
							viewPlayIndicator.onItemSelected(realSelectedItemPosition);		//修改指示器的选中项
						} 
						if(onItemSelectedListener != null){		//回调
							onItemSelectedListener.onItemSelected(parent, view, realSelectedItemPosition, id);
						} 
					} 
				}); 
				viewGallery.setOnItemClickListener(new OnItemClickListener() {
					@Override 
					public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
						if(onItemClickListener != null){		//回调
							onItemClickListener.onItemClick(parent, view, viewPlayAdapter.getRealSelectedItemPosition(position), id);
						} 
					} 
				}); 
				viewGallery.setAdapter(viewPlayAdapter);
				 
				//初始化默认选中项 
				int defaultPosition = 0;