Android Photo stream layout like instagram - android

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.

Related

Equivalent of web partial in Android

I am more familiar with web, but I am programming an Android app.
This is a beginner question, but I'm having trouble wrapping my head around reusable views in Android. On the web, I would create a partial view and pass parameters to be added via a templating language. What is the best way to do this on Android?
More specifically, I am trying to add a grid view where each slot of the grid has an image and a subtitle with a border. I want to dynamically load the image and subtitle from the database, and add an unknown number of images to the grid.
How could I create a view to hold the images and subtitles and then dynamically load them into the grid with different data?
Creating a GridView programatically:
http://www.codeproject.com/Questions/705639/how-to-create-gridview-in-android-programaticall
This should help you with the skeleton and you can add an ImageView and TextView as per your requirements.
How could I create a view to hold the images and subtitles and then dynamically load them into the grid with different data?
You need a GridView and an Adapter to load the items dynamically into your grid. I can't post the code actually here, because it would be a very long answer. But Here is a nice tutorial to get you started. In the example, there is a grid build with dynamic images showing step by step what you're looking for.

How to create clickable photo collage in android?

I want to create as per below image in that all blocks contains the image we can call it photo collage and its will also clickable. How can I make this using GridView or any other view or library.?
If anyone has any idea related to this then please suggest me the write way.
From what I understand from your question, you want to show multiple images in a grid view like pattern and they may have different sizes/aspect ratios? Right?
QuiltView can be used to achieve this.

How to Use Adapter While Filling Layouts

I know it may be weird that I want to succeed.
Let me explain whole in details. Firstly, I want to use two ListView looking in an Activity screen. Just like how Pinterest looks like. (I'm not sure is it true but it's named as heterogeneous gridview.) There is also one thing that I needed to implement: lazy loading. There are about 30 images in my activity, so that's not good to fetch all images at one time. That's why I needed lazy load.
So in first, I pondered on that I how obtain that appearance, I mean heterogeneous gridview. Then decided to add to LinearLayout in a ScrollView. Linears have vertical orientation. With thay approach, I added my new views by using odd-even method in Linear Layouts.
Althought, there weren't any adapter so according to my knowledge, there is no way to controll which items would be displayed. So lazy load is not suitable.
I've also tried two ListView in an Activity, but got some lag and also synchronous scroll problems. On the other hand it has a bad recycling.
So in this scenario, I want to ask is there way to fill LinearLayouts using Adapter? Or what would you recommend to create a heterogeneous gridview but also with lazy load.
If my approaches are wrong, I would not hasitate to change it.
Any clue would be great for me. If there is something unclear, please specify it. I'll explain with more details.
After a lot of research, finally I found a library which have lazy loading and heterogeneous gridview and also not has any scroll or recycling lags/problems.
Maurycy's StaggeredGridView is completely what I'm looking for.
Here is the library and also there is a demo too.
If I get your question right, here is what you need: http://spinlist.autsia.com/

Android: Is this just a custom ListView?

Feed in Four Square android app looks like this:
A rectangular box with actual post, below which is a Text like 10 people like this and so on.
Is this just a listView with Actual content having margins and a different background, and TextViews below it.
Because when i had a complicated ListView with an ImageView and 5-6 TextViews, it takes lot of time to load the UI.
1 of my friends who work on iOs said Instead of Custom ListView Items, use ImageView which look like a Custom View with images and textviews. Which makes loading lot faster. But ofcourse it takes lot to implement such thing.
I just want to know, if its just another custom listview?
And that my delay to load the UI is because of someother reason?
Such techniques are available in android too??
Thank You
Could be a ListView with complicated children views. Could also be an ExpandableListView.
There's a few reasons why it may load faster than something you've used before:
The images were probably already cached on the file system, so it loads from local storage rather than downloading the image.
The images were already the correct dimensions, so no resizing was needed.
Image loading was done on a background thread as to not lag the UI while images were being loaded into memory.
You could expand a complex layout for each ListView item in Adapter.getView() and remove (View.setVisibility(View.Gone)) on the views you don't need based on the item's object you want to render.
If you want to reuse the expanded layout don't forget to set the visibility of everithing again to View.VISIBLE.
I'm already doing this in my code:
if (post.getImageURL() != null && !post.getImageURL().isEmpty()) {
holder.image.setVisibility(View.VISIBLE);
holder.image.setScaleType(ScaleType.FIT_CENTER);
displayImage(post.getImageURL(), holder.image);
} else {
holder.image.setVisibility(View.GONE);
}
In this case I'm hidding an optional image.

Custom Adapter for Gallery View in Android

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.

Categories

Resources