android-recyclerview

Recycler View creating duplicate items

前提是你 提交于 2019-12-12 03:46:56
问题 I am using Recycler View for creating a list of items and I am getting a duplicate items in the list. I have passed a list of 30 size into the Recycler View Adapter. The created list has 30 items but there are only 3 unique items, all other are repetition of 3 unique items. I am not able to find the bug. public class CollectionAdapter extends RecyclerView.Adapter<CollectionAdapter.CollectionViewHolder> { private List<CollectionDataTypeModel> mDataSet = new ArrayList<CollectionDataTypeModel>()

How do display data from Parse.com to android recycler-view?

大兔子大兔子 提交于 2019-12-12 03:44:55
问题 I am trying to pull data from Parse.com cloud to my android application.This is the code for my custom adapter: public class AdvertisingAdapter extends RecyclerView.Adapter<AdvertisingAdapter.TatsViewHolder> { List<AdvertInfo> data = new ArrayList<>(); private LayoutInflater inflater; public AdvertisingAdapter(Context context, List<AdvertInfo> data){ inflater = LayoutInflater.from(context); this.data = data; } @Override public TatsViewHolder onCreateViewHolder(ViewGroup parent, int viewType)

item click for recycler view

风流意气都作罢 提交于 2019-12-12 03:38:01
问题 I am trying to implement on item click for different items that i pop up in RecyclerView . I achieved that in listView but RecyclerView seem to be difficult. I have look at similar questions but couldn't get a solution. if the user clicks on One, I want it to do something, also for two, and three. How do i get achieve this? Here are my codes public class MainFragment extends Fragment implements SearchView.OnQueryTextListener { public static MainFragment newInstance() { return new MainFragment

RecylerView changing single parameter in a row?

雨燕双飞 提交于 2019-12-12 03:36:52
问题 I have RecyclerView, single row includes text, image. After loading data, in a button click i want to change text without reloading image of the row. I tried using notifyItemChanged(position). But it makes image reloading.. Am using glide for loading images, so when i use notifyItemChanged(position), row flickering occurs 回答1: Whole row will be reloaded once you call notifyItemChanged() Two options: 1) Disable default recyclerview item animation ItemAnimator animator = recyclerView

RecyclerView not populated until SearchView interaction

南笙酒味 提交于 2019-12-12 03:36:45
问题 I'm facing an issue with my recyclerview, which has a custom adapter. Issue is that when the activity opens, recyclerview is empty. When user types anything on SearchView's text field, recyclerview gets populated and stays populated without any problems. I tried to change place of some code to fix this issue, yet no success. I've added the current and desired state screenshots below the codes. Thanks in advance. AddCourseActivity: public class AddCourseActivity extends AppCompatActivity{

Adding components dynamically to RecyclerView

為{幸葍}努か 提交于 2019-12-12 03:36:24
问题 I'm displaying daily events. The number of events/day is variable. Each item in the RecView is a Day which should contain as many views as the number of events. Here is one item's layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/llDay"> <TextView android:layout_width="wrap_content" android:layout_height=

Is there a better way to execute this code (load multiple urls)?

橙三吉。 提交于 2019-12-12 03:33:59
问题 my code is working but when i launch the app, it is not fluent, i was wondering if there is a better way to make this code work or more cleaner to improve quickness ? Please any answer is welcome. Thank you. public class MainActivity extends AppCompatActivity { public static final String TAG = MainActivity.class.getSimpleName(); private List<Articles> mArticlesList; private RecyclerView mRecyclerView; private String[] mUrl = new String[]{"https://newsapi.org/v1/articles?source=buzzfeed&apiKey

RecyclerView and Toolbar, can't scroll bottom item into view

六眼飞鱼酱① 提交于 2019-12-12 03:32:57
问题 EDIT: See Using the Master/Detail template in ViewPager Fragments (download link) for full code I have a toolbar and a recyclerView . When the layout is first inflated the last item of the recyclerView is out of the scroll-able region of the screen and is therefore not visible. After rotating the item appears. It is apparent that the toolbar is pushing the recyclerView outside the boundaries of the screen. If I add padding to the bottom of the recyclerView with the height of the toolbar the

Calling getWidth of parent in onCreateViewHolder

☆樱花仙子☆ 提交于 2019-12-12 03:28:26
问题 Is it ok to get parent's width in onCreateViewHolder at RecyclerView adapter? Are parent's dimensions measured at that state so I don't get 0 when I call getWidth() on parent? 回答1: Yes, the parent is actually the RecyclerView . It has both a non-zero getWidth() and getMeasuredWidth() by the time onCreateViewHolder is called. Easy way to verify this is set your debugger to stop in the method and inspect the parent. parent = android.support.v7.widget.RecyclerView{d08d560 VFED..... ......ID 0,0

Android loading image with volley + recyclerView

[亡魂溺海] 提交于 2019-12-12 03:24:59
问题 I'm trying to load images in a RecyclerView . It's working alright until I scroll left and right (horizontal RecyclerView ), some pictures disappear (the one at the edges) with the following error : Volley: [3267] NetworkDispatcher.run: Unhandled exception java.lang.IllegalArgumentException: width and height must be > 0 Now here is my adapter class (I believe the problem is here) : package com.rezadiscount.rezadiscount.adapter; import android.content.Context; import android.support.v7.widget