In my android mobile app, i have list of lot of (more than 200) images and textviews. For that currently i am using gridview.
But my problem is if i am request all that content at once from server then its take too much time to load and render that images and text in gridview which affect user experience.
So i thought of load only 30-40 items at once and then provide load more button at end. But it is not appropriate way to do this thing.
So can anyone please give me other alternatives to do this thing?
fallow this tutorial analyze code and use it.developer tutorial for displaying images.
Related
I'm working on a simple gallery app. I'm wondering what's the best way to create and dsiplay thumbnails. I was thinking about using ThumbnailUtils, making thumbnail for new pictures and then store it in app data storage as I assume that doing it every time when user displays all images isn't efficient. Though I'm not so sure what's better memory-wise. To load an image into ImageView which is part of RecyclerView item I'm using Glide. I don't know if .thumbnail(...) does what I want so I think I need to create thumbnails myself. Could someone show me the correct way to do this? I want the app to load quickly so it's obvious I can't load full resolution images to recycler.
The best way for your result is to use the GridLayout. I wrote an answer yesterday how to achieve that Widget. Take a look. Cheers!
I'm currently building an app for learning purpose (new to android programming) that lets the users to upload
image to the server and watch other users images (by swipe the screen for example).
I finally succeeded to let the user upload image to the server and I was wondering how to code the part that retrieve the images from the server and present them in the app.
Assuming I have at the time million images, I don't want the app to load all the images in the same time because it will take a lot of time.
And all the guides I'v seen makes the app to load all the images at once.
So my question is what is the recommended way to do so?
Hope I was clear.
Thanks.
Let's say you have an array with a million images in your server to load in your app that will be shown in a RecyclerViewand assuming a screen can fit about 5 images.
In this case scenario a good approach would be to fetch 10 images at a time and load them in a RecyclerView. Load the first 10 images and once the user reaches the end of the scroll load some more images, add them to the previous retrieved image list, and finally update your RecyclerView to present them. With some effort you may be able to create a Facebook look alike effect.
RecyclerView has methods that will easily help you detect the end of scroll (there are plenty of ways you can find in StackOverFlow). Every time you detect an end of scroll, just upload more images.
This is one example: How to know whether a RecyclerView / LinearLayoutManager is scrolled to top or bottom?
Use FlexBox Layout for better UI Design to show images
https://github.com/google/flexbox-layout
See how this cat images are shown using FlexBox Layout
I am working on an Android app where, once a user clicks a login button, the app launches an AsyncTask to verify account details with a remote server. That part works fine by itself and doesn't make my app slow. However, when you click the login button, it launches a second activity where I have 4 ImageViews. When I added that part of the app, it became significantly slower (from less than a second to about 5 seconds loading time). I load the images into the ImageView from the XML layout file directly, so I'm not sure what I'm doing wrong.
My question is that do ImageViews make your app slow, and if so, how do you optimize their performance?
I was working my own app when I actually experienced this too. The reason is because if the files are to big they take a while to load into memory and set as the Image View. There is two ways you could really sort it out.
1: Get a smaller version of the picture. Smaller pictures come up faster and aren't prone to an OutOfMemory exception which kills the app :(.
2: A better way is to use the Picasso api. I used this APIs to add images in list views, expandable list view with pictures in them. The app was fast and fluid :)
Picasso's api would be your best bet ant it is easy to implement.
Edit:
Here is the link to the site to get the APIs :)
Picasso
The only way I could figure this out is to create an image in photoshop that has all the buttons laid out where you want them on top of the image. Interpret it into your app and put regular buttons over top of the imagebutton pictures that you placed onto your background image. Set the size accordingly to your images of your buttons and then set the background of each button to #null so they aren't seen. Now trying to figure out how to interpret this into orientation view even though I don't think I'll be using orientationview. OH AND CHANGED THE EXTENSION TO A GIF TO SAVE ON DATA RATHER THEN PNG.
Hope this helps I'm sort of new at coding on android as I have lots of experience with HTML .
Cheers
THANKS FOR THE DOWN LIKE I WAS SORT OF NEW AT THE TIME OF NOT KNOW OTHER WAYS TO SET THIS... THANKS THOUGH, MORONS
I am developing one application for one real state website. I have to display dynamic content from web I mean website display lots of images and description about the property. i need to populate images and their description in list view similar to flipkart android app do. I don't know how to proceed as of now i have thought i can download all images to sd card and get the text from json and then populate both in custom list. but i feel this is not a good approach as images grows in no it would take memory. Please give me some pointer how i should proceed to get better results.
Thanks in advance. Any help will appreciated.
You can simply use custom listview with image and text.
Get image and text both from web.
You can also refer to this link.
This could potentially be a duplicate but I after spending several hours reading about ImageView, ImageSwitcher, Gallery Views, Lazy Loads, and more I decided I should just ask.
I am working on an app and in one of the screens there may be an image or multiple images associate with what I am talking about. The other data for this intent will be pulled from a local database. In the database it will also have a list of URLs of images that are associate with each thing that I am discussing. So I would like to know the best way to display a thumbnail of these pictures (if there are any) on the screen. Then if these pictures are clicked on it can open up the bigger version of these pictures. I don't necessarily want to download these pictures since I don't want to save them locally for the app. Plus I don't want to make the page delay in loading while it waits to download the pictures.
What is the best way to handle this scenario?
I have to caution you, that with newer versions of Android, applications can't make connections to the internet that build the UI directly on the UI thread. Instead, it must be accomplished in a background thread such as ASyncTask. So if you're going to go with making ImageViews without src in your XML, that's fine, but you can't just have the ImageViews go download their images via URL in the onCreate of your main activity any longer. It has to be done in the background, else you'll get an error.
It makes the process fairly more complex, to be honest, but it does improve application responsiveness.
For now, since images aren't the main focus of my app, I decided to just embed a webview in my page and then display the image in some custom html ( I had a list of URLs to the images online). I also calculate the width of the screen and then I adjust how wide the images are going to be in my html.
This was the easiest since the webview takes care of the "threaded" part and I don't have to worry about how to handle/save/and display the images.
It would have been helpful to see a best practices guide when it comes to android and handeling images.