I am working on a "users" activity that show online users in a chat application, to show them I am using a ListView and every item contains the profil photo, the name and an extra textview about the online user.I am storing images in FirebaseStorage.
the problem is that when I scroll the items aren't stable and some images of other users are shown in the wrong item, and I have to wait around 2 seconds until the view becomes stable.
what if I used RecyclerView ? will it change and solve this issue ? I need your suggestions.
thanks in advance.
Whenever you scroll up and down, these views are getting re-drawed with wrong options so always specify both if-else conditions cause listview doesn't know the previous state/conditions/values of our widgets.
Related
basically what am doing is am querying some data from firebase and inside these data is a URL for an image of a specific item. Now since its a query i could get different result form the firebase where i can get 4 images or sometime maybe 1 image.
And i want to display the images in a grid layout ( similar to that of Instagram posts) where the user can click on an image and it shows the user some details about that item. This is the part where am stuck at.. i dont know how to do it since i have a variable number of images.
if there is a way, please help
you can use the Recyclerview and provide the model with those details. It will automatically create those many rows in list.
Here you can follow this to do this.
I have an application "app_a" which contains a fragment ("fragment_a") with a RecyclerView to show content. The content is from database of "app_a". There may be some buttons on each RecyclerView item, click these buttons will modify some database value of "app_a".
I would like to show same content on another application "app_b" without duplicated code. Tap buttons on RecyclerView item in "app_b" will also modify database value of "app_a". Can anyone give me some suggestions to do this?
Thanks.
I'm using Recyclerview to show a list. I want to delete some items like IOS. In my listview template I have added a button to delete item which is invisible by default. In my activity I have another button attached at bottom (Not part of listview) and on tap of this button I want to make all delete buttons of listview visible.
My Question is how can I get reference to all delete buttons of listview in activity and is it the right way to do this?
Thanks
Assuming you have ViewHolders set up, you already have references to all the buttons in your list. All you have to do is to make them visible for every item in the list with a simple loop.
In case you haven't implemented ViewHolders I suggest you check out the documentation and take a look at some simple tutorials on how to use them.
On a side note. If I understood correctly you're making a bottom tab for your app and since you referenced iOS I gotta say this; Remember that Android and iOS are two unique operating systems with their own ways of handling things. Check out Googles pure Android documentation.
In your question title you say RecyclerView, but in your text you say ListView. The solution is similar either way, but it's best to be perfectly clear what you're doing.
In either case, there are at least two different solutions.
First, you could use a boolean flag to determine if all the the item buttons should be showing or not. You check this flag at the time the item view is inflated or created and toggle the button accordingly. If the boolean flag is ever changed, the easiest thing to do is tell the RecyclerView/ListView that the underlying data has changed and to redraw all the views. Call notifyDatasetChanged on the adapter.
The other thing you can do at the time the item buttons should change is iterate all the visible item views, find the button, and change its visibility. With RecyclerView, you can do this, and with ListView you can do this.
I have a listview whose data is taken from internet.
Data is a list, a long list, so I'd like to display the first, say, 10 results.
If user scrolls down I'd like a progressbar to appear at bottom, while I ask for the next 10 results to server, then remove progressbar and add the new 10 items.
I see this behaviour in the facebook app, can you point me to a tutorial to do something similar?
First, here is a tutorial for a never-ending ListView:
Android tutorial: Dynamicaly load more items to the ListView ( Never Ending List! )
I've used this in my application and it works flawlessly.
Secondly, this tutorial will teach you how to grab data from the internet and display it in your ListView: Android Custom ListView with Image and Text
Combine both of them together and you get what you need [Provided you have the basic knowledge of Android programming. Goodluck ;)]
I want to create a horizontal listview which contain many item, one item will contain a image. When user slide listview => the count of item will be fix when it display, example display only 3 or 4 image. How can I do that? Many thanks.
Edit:
I use this
to create a HorizontalList view, everything is ok but I don;t know how to make the Next and Previous button work! Any idea?
Instead of a horizontal ListView (which, as far as I know, isn't offered by the Android SDK) you can use a HorizontalScrollView. You can add the items like to any other kind of layout class.
It looks like what you are looking for is a Paginated Gallery. I have written one here.
Its still only a couple of days old but hopefully the included Activity code will get you off the ground.