android-recyclerview

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) {

Loading images from Firestore into a RecyclerView when there are multiple image types

非 Y 不嫁゛ 提交于 2020-01-16 12:33:28
问题 I have a RecyclerView which uses a GridLayoutManager and each cell consists of a single ImageView. The data that i want to use to populate it are stored in my Firestore storage as .png and .jpeg images and the naming of each one is icon#.png or icon#.jpeg where # is the respective cell's position. My issue is that when i try to load each image into the respective cell's imageView with the way that you see below, i get an error message because i can't retrieve every image due to some having a

Loading images from Firestore into a RecyclerView when there are multiple image types

 ̄綄美尐妖づ 提交于 2020-01-16 12:33:28
问题 I have a RecyclerView which uses a GridLayoutManager and each cell consists of a single ImageView. The data that i want to use to populate it are stored in my Firestore storage as .png and .jpeg images and the naming of each one is icon#.png or icon#.jpeg where # is the respective cell's position. My issue is that when i try to load each image into the respective cell's imageView with the way that you see below, i get an error message because i can't retrieve every image due to some having a

Loading images from Firestore into a RecyclerView when there are multiple image types

ぐ巨炮叔叔 提交于 2020-01-16 12:33:06
问题 I have a RecyclerView which uses a GridLayoutManager and each cell consists of a single ImageView. The data that i want to use to populate it are stored in my Firestore storage as .png and .jpeg images and the naming of each one is icon#.png or icon#.jpeg where # is the respective cell's position. My issue is that when i try to load each image into the respective cell's imageView with the way that you see below, i get an error message because i can't retrieve every image due to some having a

How to add time slot in recyclerview android

♀尐吖头ヾ 提交于 2020-01-16 11:42:14
问题 I have recyclerview a and all times will be displayed. I want to display slot type. should i use any library to code layout like that? or we can do in our xml itself. please someone suggest me activity_booking_calender.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" android:orientation="vertical"> <RelativeLayout android

How to add time slot in recyclerview android

╄→尐↘猪︶ㄣ 提交于 2020-01-16 11:41:49
问题 I have recyclerview a and all times will be displayed. I want to display slot type. should i use any library to code layout like that? or we can do in our xml itself. please someone suggest me activity_booking_calender.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" android:orientation="vertical"> <RelativeLayout android

Can we make use of in built setOnCliclListener on recycler view row item instead of custom item click listener?

亡梦爱人 提交于 2020-01-16 11:25:14
问题 I have seen many examples for providing click functionality (for selecting row item in recycler view) to a row item, but all of them are using custom click listener class to achieve this. Is there any method to achieve this click functionality? 回答1: Detecting click on a RecyclerView item is very easy. All you need to do is define an interface (if you're not using Kotlin, in which case you just pass in a lambda): public class MyAdapter extends RecyclerView.Adapter<MyViewHolder> { private final

Getting visible and Non-visible items from RecyclerView

大憨熊 提交于 2020-01-16 08:48:27
问题 This simple code below ONLY gets all visible items, but I need to get all items (both Visible and non-visible). Is this possible to get completely all Items and how? // This gets only visible items final RecyclerView.ViewHolder holder = recyclerView.findViewHolderForAdapterPosition(index); // Same as this final View child = recyclerView.getChildAt(index); final RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(child); I am also interested in any work around this. If possible.

Getting visible and Non-visible items from RecyclerView

ⅰ亾dé卋堺 提交于 2020-01-16 08:48:22
问题 This simple code below ONLY gets all visible items, but I need to get all items (both Visible and non-visible). Is this possible to get completely all Items and how? // This gets only visible items final RecyclerView.ViewHolder holder = recyclerView.findViewHolderForAdapterPosition(index); // Same as this final View child = recyclerView.getChildAt(index); final RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(child); I am also interested in any work around this. If possible.

(Rest Api) Recycler View with Accept and Decline a request Buttons in each Row in android

我与影子孤独终老i 提交于 2020-01-16 08:06:49
问题 I am developing an android application based on Rest Api remote data, in which I have made one RecyclerView . I have added 2 buttons with each row in RecyclerView . These 2 buttons are Accept and Decline. When user selects accept button certain portion of the JSON Property have to change to True and if selects decline button certain portion of the JSON Property have to change to false and @POST it. How can I do it? I’m new in Rest Api with RecyclerView , so if you know the solution please