In GridView the item at index 1 is not receiving click event but all other items are receiving click event in Galaxy S and in HTC Hero all items are receiving click event.What is this? Please explain.......thanks for giving time.
You shouldnt have any issues with this. i have used it tons of times. be sure to check the code you are using. Try to log the position in onItemClick see what it returns. also click don't work if you are using buttons or other similar controls inside the list rows. that requires a different aproach.
Related
I am trying to get the views/view holder for the items of RecyclerView which are currently not visible in the list(I have scrolled down), like I scrolled to bottom and want the first child/item/row view.
I have tried using following methods but was unable to get the views/viewwHolder :
1. findViewHolderForLayoutPosition(position)
2. findViewHolderForAdapterPosition(position)
3. recyclerView.getChildAt(position)
4. recyclerView.getLayoutManager().getChildAt(position)
5. Inside adapter I made viewholder.setIsRecyclable(false) but still didn't work.
All of these approaches worked on some devices but not on all Android devices like Oppo devices.
I need some fool proof solution for this, please help with that.
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'm having an issue with checkboxes on a listview, checking items, and listing just those checked items. This is my first android app, and without knowing what all is needed here in the way of code to help figure it out, I have recreated the problem in a bare-bones app that demonstrates what is going on. I suspect it is in the getView() method, but I'm not really sure.
Problem One: When more items are in the list than are visible, checking items at the top of the list also checks items that are not visible.
Problem Two: In the onOptionsItemSelected method there are two ways I've tried to get just the checked items. One is currently commented out, but they both fail in different ways. There are comments above each method that expalins what goes wrong.
In my game application am using a listview to select levels. Am activating this listview item onclickable if the previous level is cleared. I need to differentiate the activated and unactivated level's in listview.How can i make it possible? If possible suggest me tutorial. Thank you
you can put your logic for activated and unactivated levels in getView method ,check if activated then inflated activated row otherwisw unactivated row.
First check this and this stackoverflow questions and try some code and post your question if you have any problems. Please try first.
You can use setClickable(false) to disable touch events on list. To make it look disabled, you can change the textView colors in the list items and get such effects.
Thanks
My Query is in my ListView let say if I scroll to 1st position that is fine but now my ListView scrolls beyond that also like my fisrt item will also go down and there is no item before first item so blank screen comes which is looking very bad i hope, i have described well can anybody look into this.
I have seen this issue in Galaxy S while over other devices this behaviour is not followed. So I think some device manufacturers have modified their OS and we can't do anything in this case.