- cache the images to disk
- use a List<String> to store the paths to the cached images
- extend a BaseAdapter and use the List<String> as your data source
- add a setPage(int page) method to set which page of 10 images you're
on
- in getView() adjust the value of position to account for the page
index

quick example from memory:


public class PagedPhotoAdapter extends BaseAdapter {

  private static final int PHOTOS_PER_PAGE = 10;

  private final LayoutInflater mInflater;
  private final List<String> mPhotoPaths;
  private final int mPageCount;

  private int mPage = 0;

  public PagedPhotoAdapter(Context context, List<String> photoPaths) {
    mInflater = LayoutInflater.fromContext(context);

    mPhotoPaths = photoPaths;

    mPageCount = (mPageCount.size()/PHOTOS_PER_PAGE);
  }


  public void setPage(int page) {
    mPage = page < 0 ? 0 : page > mPageCount ? mPageCount : page;
  }
  @Override public int getCount() {
    return PHOTOS_PER_PAGE;
  }
  @Override public Object getItem(int position) {
    return position;
  }
  @Override public int getItemId(int position) {
    return position;
  }
  @Override public View getView(int position, View convertView,
ViewGroup parent) {
    final int adjPosition = ((PHOTOS_PER_PAGE * mPage)+position)-1;

    final ImageView imageView =
      (ImageView)(convertView==null?mInflater.inflate
(R.layout.layout_id, null):convertView);

    imageView.setImageBitmap(BitmapFactory.decodeFile(mPhotoPaths.get
(adjPosition)));

    return imageView;
  }

}


On Jan 28, 4:40 am, surya prakash <[email protected]> wrote:
> Hi
> I am getting photos from website and display them in Grid view, but
> here I do not want display all of them at time,
> 1. I want show only 10 photos and a "more" link below the grid , but i
> can display "more" link at top, how can I add it at bottom?
> 2.when user click on "more" it should display the another 10 photos
> only, I need to refresh the grid, how can we refresh the grid?
>
> Thank  you

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to