I want to get string in my adapter class on view holder in on click method my app crash when i implement the code write below in on click if(postion==1). Answer If you look at the docs you’ll see that Resources.getSystem().getStrings will provide you with system wide strings, not the ones in your application (strings.xml). Replace the following line with
Tag: android-recyclerview
Android: set fixed item on RecyclerView
I have a RecyclerView, when I click in the first view it adds another view like in the image, what I want is to set the “add” view which ID is “1” to be fixed in the last position of the recycler instead in the first. My adapter: In the activity: Answer I solved it by creating a custom adapter
Android how to play different sound for each item in recyclerview
I build app with images of animals, and after you click on animal, its play sound for that animal. I use Recyclerview for displaying all animals items. My problem is that i do not know how to handle click event for playing sounds for each animal. I do know how to play same sound for each item in recyclerview but
Android – RecyclerView with one layout, multiple setVisibility
I have a basically all in one layout which has everything needed for my app’s main feed. All variable items (images, video thumbnails.. Etc.) are set to GONE at first and set to VISIBLE when it is needed. The problem is sometimes, might be due to RecyclerView’s recycling behavior, the item which is supposedto be GONE is VISIBLE in the
Recyclerview not call onCreateViewHolder
My RecyclerView does not call onCreateViewHolder, onBindViewHolder even MenuViewHolder constructor, therefore nothing appears in RecyclerView. I put logs for debugging, and no log is shown. What might be the problem? My adapter: My custom row XML: and my Fragment: Answer Your getItemCount method returns 0. So RecyclerView never tries to instantiate a view. Make it return something greater than 0.
Android 5.0 – Add header/footer to a RecyclerView
I spent a moment trying to figure out a way to add a header to a RecyclerView, unsuccessfully. This is what I got so far: The LayoutManager seems to be the object handling the disposition of the RecyclerView items. As I couldn’t find any addHeaderView(View view) method, I decided to go with the LayoutManager’s addView(View view, int position) method and
Android RecyclerView addition & removal of items
I have a RecyclerView with an TextView text box and a cross button ImageView. I have a button outside of the recyclerview that makes the cross button ImageView visible / gone. I’m looking to remove an item from the recylerview, when that items cross button ImageView is pressed. My adapter: My layout is: How can I get something like an