[android-developers] Re: show more photos
- cache the images to disk - use a ListString to store the paths to the cached images - extend a BaseAdapter and use the ListString 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 ListString mPhotoPaths; private final int mPageCount; private int mPage = 0; public PagedPhotoAdapter(Context context, ListString 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 surya@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: show more photos
It may also help you to look at Romain Guy's PhotoStream demo application. The source is available at code.android.com. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: show more photos
Thank you Nerdrow On Jan 29, 3:55 am, Nerdrow troybe...@gmail.com wrote: - cache the images to disk - use a ListString to store the paths to the cached images - extend a BaseAdapter and use the ListString 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 ListString mPhotoPaths; private final int mPageCount; private int mPage = 0; public PagedPhotoAdapter(Context context, ListString 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 surya@gmail.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: show more photos
Thank you Frank Weiss On Jan 29, 8:11 am, Frank Weiss fewe...@gmail.com wrote: It may also help you to look at Romain Guy's PhotoStream demo application. The source is available at code.android.com. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en