public ImageAdapter(Context mContext,TextView tv){
this.mContext=mContext;
this.tv=tv;
}
public int getCount() {
// TODO Auto-generated method stub
return Integer.MAX_VALUE;
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ImageView imageView=new ImageView(mContext);
imageView.setScrollbarFadingEnabled(true);
if(position==0 || position==1){
tv.setText(schoolName[position%imgs.length]);
}else{
tv.setText(schoolName[(position-1)%imgs.length]);
}
imageView.setLayoutParams(new Gallery.LayoutParams(280,180));
imageView.setImageResource(imgs[position%imgs.length]);
return imageView;
}