recycler-adapter

java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1 in recyclerview adapter

烂漫一生 提交于 2020-01-16 15:18:19
问题 I am using a recycler view. Here is the adapter public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { private List<Contact> myContacts; private Activity activity; public MyAdapter(List<Contact> contacts,Activity activity) { this.myContacts = contacts; this.activity = activity; } public class ViewHolder extends RecyclerView.ViewHolder { public TextView mTextView; public ImageView mColorView; public LinearLayout linearLayout; public ViewHolder(View v,MyAdapter adapter) {

Starting a coroutine inside onBindViewHolder creates a mess with recycler

一世执手 提交于 2020-01-16 09:08:18
问题 I am developing a chat application and there is a specific API so some things i must implement them with a specific way. For example (and the case that i have a problem...) When i have to display an Image the API says that i have to split the Image in small chunks and store them as a message with a byteArray content. There is also a header message that its body is the messageIds of the fileChunks. So in the RecyclerView inside the onBindViewHolder, when i see a header file message (msgType ==

Expandable RecyclerView: How to have different “child-rows” (which are displayed when an item is expanded) have different layouts?

≯℡__Kan透↙ 提交于 2020-01-15 09:12:32
问题 I am trying to use this library project by dgreenhalgh for creating an expandable RecyclerView, but my requirement is to have an expandable RecyclerView with different layouts for different rows . So I first wrote a small example application to test the library project. I am posting it here. Now I need to make it use different layouts for different children-rows - i.e. when the user clicks on an item in the list (let's call that parent-row for now), it is expanded to show its children-rows,

Change TextView in MainActvity from RecyclerAdapter using Kotlin

只谈情不闲聊 提交于 2020-01-15 09:11:24
问题 I want to change the text in a TextView (id: dailyTotalTextView) in MainActivity, when I click a button in a RecyclerView. But I get an error saying dailyTotalTextView must not be null. I have a basic knowledge of Kotlin and no Java experience, so I might be going all wrong about this. The TextView displays the sum of values in a list. The list items contain a number and a button to delete the item. When I delete an item I want the TextView to change the total. In MainActivity an item can be

Change TextView in MainActvity from RecyclerAdapter using Kotlin

我怕爱的太早我们不能终老 提交于 2020-01-15 09:08:31
问题 I want to change the text in a TextView (id: dailyTotalTextView) in MainActivity, when I click a button in a RecyclerView. But I get an error saying dailyTotalTextView must not be null. I have a basic knowledge of Kotlin and no Java experience, so I might be going all wrong about this. The TextView displays the sum of values in a list. The list items contain a number and a button to delete the item. When I delete an item I want the TextView to change the total. In MainActivity an item can be

How to disable already booking slot in android

纵然是瞬间 提交于 2020-01-15 06:28:11
问题 I have to disable already booking slot and show only available slot to user. in recycler view time will be visible from 09:00Am to 09:00Pm. already booked slot should be in disable mode and user can select only available slots. in main activity im storing all the time slot from 09:00AM to 09:00PM and pass into adapter. here in adapter class i want to fetch booked slot from firebase and compare those slots in time arraylist object. getHourarray() ArrayList<TimeSlot>times = new ArrayList

Horizontal recyclerview inside vertical recyclerview scrolling perfomance

穿精又带淫゛_ 提交于 2020-01-14 04:23:10
问题 I have almost this: https://github.com/RyanHurst/TvProgramRecyclerView. Horizontal recyclerviews as an item of a vertical recyclerview. Every horizontal recyclerview scroll is syncronized (only visible items). Horizotal scrolling is very smooth, but vertical scrolling is really bad. When scrolls in the position 0 on horizontal scroll, it runs very well, but the most you scroll to the right the most laggy it becomes. I tried not to setting the recycler adapter in onBinViewHolder and using a

FirebaseIndexRecyclerAdapter onDataChanged is called but getItemCount() always return 0

别等时光非礼了梦想. 提交于 2020-01-13 19:49:21
问题 I'm using FirebaseIndexRecyclerAdapter which gets a keyRef and dataRef and is very helpful with getting all dataRef's children which their keys exists as children in keyRef. The data is being displayed correctly but if i'm overriding onDataChanged for hiding a progress bar and/or displaying an empty state depends on the itemsCount (Something which i've already done with FirebaseRecyclerAdapter and works as expected) but getItemCount always return 0(!) private class MYAdapter extends

Create RecyclerView item layout based on content of data

烂漫一生 提交于 2020-01-13 19:42:51
问题 I'm creating a recycler view of data objects, each of these object will vary, eg. Obj 1 - String Heading - String Desc - Image Obj 2 - String Desc Obj 3 - Image - String Link Obj 4 - String Desc - Video etc So I need to create my item layout dynamically to suit each data object. I don't want to create an item layout with all the possible views and components and show and hide as I feel it's bad practice. So my issue is I need to access an object from the list using the position in the

Create RecyclerView item layout based on content of data

和自甴很熟 提交于 2020-01-13 19:41:08
问题 I'm creating a recycler view of data objects, each of these object will vary, eg. Obj 1 - String Heading - String Desc - Image Obj 2 - String Desc Obj 3 - Image - String Link Obj 4 - String Desc - Video etc So I need to create my item layout dynamically to suit each data object. I don't want to create an item layout with all the possible views and components and show and hide as I feel it's bad practice. So my issue is I need to access an object from the list using the position in the