What is the best way to present a full screen picture gallery read from a directory.
I was thinking of using an ImageView for full screen bitmap display and then using viewPager for swipeing to the next image.
Which would mean that I would need to have at least PICTURE,PICTURE+1 and PICTURE-1 always in memory.
is this proper way or is there a better one?
Allows you to do what you want and recycles the fragments for reuse after swiping through
http://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html
-- Update --
As pointed out in the comment, the gallery is deprecated.
The gallery doc says to use a ViewPager or a horizontal scroll list : http://developer.android.com/reference/android/support/v4/view/ViewPager.html
http://developer.android.com/reference/android/widget/HorizontalScrollView.html
-- Old answer --
Is there a reason you wouldn't want to use the built-in gallery ?
http://developer.android.com/reference/android/widget/Gallery.html
As for managing memories and bitmap, the android put up a post on this :
http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html
Related
Alright, I want to do something like a Gallery of images, scrolling from left to right. The user is going to register barrages, and he needs to take many picture of this barrage. I already know how to save the data, and how to show using listview with adapter, I did with listview thinking that I could change to horizontal somehow, but I searched and I can't. What should I use to do that? What I want is a gallery with the first photo being a plus to when you click it opens a new intent that take a picture and a description of the pic and save it, I know how to do that with listview, but it's not what I want. I saw that gallery view is deprecated, so I should use HorizontalListView?
Gallery is deprecated, yes. So maybe HorizontalListView.
But i think, that you can use fragments with animation
Use linearLayout that is placed in horizontalScrollView and on runtime Add pictures to that LinearLayout that has orientation set to horizontal. Best practise will be create your own class where you will have specified LayoutParams that you will apply to each ImageView generated on runtime , then you just need to add it to layout.
You can define method like addPictures(LinerLayout yourLayout,int amountOfPictures,Array pituresPaths) that will be loop which will create ImageViews for specified amount of Pictures and paths you can take from ArrayEditLike xoxol_89 mentioned you can use Fragments , advantege will be that FragmentAdapter dynamically recreates and destroys fragment objects so that solution with many pictures will be more memory resource efficient
Given I have a large text that I want to display on screen, which is paginated; which android view should I use? Viewpager seemed like a good choice, but I don't know if viewpager scales well if you have something like 10000+ pages on low end devices.
Any help in the right direction is greatly appreciated.
Why not make a book-like experience, with some libraries like https://code.google.com/p/android-page-curl/
Viewpager by default only loads 3 pages at a time. Therefore it can be a good choice. However, you will need to create your own adapter for the viewPager.
I am guessing that the pages are stored in the file system. In that case it would be wise to create an object that can load the pages to the memory and pass it as argument to the adapter.
I need to create a photo feed layout for android similar to instagram's. What is the best layout to use as the parent? A TableView or a ListView? Something else? Also how does Instagram not run out of memory loading so many photos at once?
GridView does what you are looking for, and is fed by a ListAdapter. This will also handle recycling views to manage memory.
I'd like to create a gallery of photos that swipe left and right. At first I took a look at Gallery, but it's marked as deprecated.
http://developer.android.com/reference/android/widget/Gallery.html
We're told to try ViewPager instead. But the PagerAdapter class doesn't handle recycling of views for us (like a standard ListView), does it?
http://developer.android.com/reference/android/support/v4/view/PagerAdapter.html
Is it up to us to build the recycling mechanism?
Thanks
But the PagerAdapter class doesn't handle recycling of views for us
(like a standard ListView), does it?
No, and I think it's because it was built assuming you are using different layouts for each of the page.
Also, as it is not being scrolled as fast as a ListView (you cannot "fling" a ViewPager to skip multiple pages), I think it doesn't need to have to recycle.
This HorizontalListView is great, i used it to do exactly what you want.
see the link in the edit on this question The link in the Edit, and the answers give you some possible ways to solve.
There is also a HorizontalListView online somewhere if you search for it that makes a fine replacement for Gallery and does recycle its views.
hi i want to split my gallery with 5 images in 2 rows.
Please let me know how to do this in android using Gallery View & custom adapter for Gallery view.
Is there any sample code available please share it, i have already checked the previous posts in this site.
Thanks
If you still need this and Pagination instead of scroll will work for you, you might look at: https://github.com/sfarooq/PaginatedGallery
I designed it using ViewPager so you can manipulate the adapter to send any kind of views you want including two row views.
If you must use scrolling galleries you could implement two separate gallery in a vertical orientation and send touch events from each to the other.