recycler-adapter

RecyclerView in Fragment : No adapter attached skipping layout

∥☆過路亽.° 提交于 2020-01-30 12:06:46
问题 I'm trying to use RecyclerView in Fragment, but I'm facing a problem, my list doesn't appear and I have this error: E/RecyclerView: No adapter attached; skipping layout I checked the solutions, apparently the problems appeared when: RecyclerView initialized after Adapter Bind and set recyclerView in onCreateView instead of onViewCreated But I gave attention, I tried alternatives and I'm still facing the same issue. Here is my code of the fragment: import android.databinding.DataBindingUtil;

Scroll Recycleview to Top position when activity starts using Linearlayoutmanager

拜拜、爱过 提交于 2020-01-30 10:25:08
问题 I"m retrieving Firebase RealTime Database to my Recycleview Adapter Class . I want to sort the data by date with latest post at top. I'm using llm.setReverseLayout(true); which works but now when activity opens then recycleview automatically scrolls to bottom itself. But I want it to force it to Top. Here is my Code rv.setHasFixedSize(true); LinearLayoutManager llm = new LinearLayoutManager(this); llm.setReverseLayout(true); rv.setLayoutManager(llm); llm.scrollToPositionWithOffset(0, 0); rv

How to inflate different layout in RecyclerView based on its position in onCreateViewHolder method

二次信任 提交于 2020-01-25 07:24:27
问题 I am trying to refactor my ListView to RecyclerView and I stuck in this situation. In my ListView Adapter i have something like this: @Override public int getItemViewType(int position) { if (mDecommissionMode && position == getCount() - 1) return 1; return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (getItemViewType(position) == 0) return getNormalView(position, convertView, parent); else return getManualDecommissionView(convertView, parent); } I

Android Load Full Image Recyclerview Cardview

偶尔善良 提交于 2020-01-25 07:24:08
问题 The following is my recyclerview using php mysql and volley library in the attached image. As of now when one clicks the displayed image a toast of the image name appears as seen. Is it possible to load the full image click instead of the toast message?. Thank you in advance MAIN ACTIVITY @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageTitleNameArrayListForClick = new ArrayList<>();

Adding Click listener to Generic Adapter

落爺英雄遲暮 提交于 2020-01-25 06:47:12
问题 I have created a Generic Adapter which will be used for any type of Data and any number of items (row_layout) in RecyclerView. I have added clicklistener to it's GeneralViewHolder .Is there any flaw or issue in this adapter. And is there any callback which reduces recyclerView ? GenericAdapter.kt class GenericAdapter<T>(protected val items: List<T>, val adapterBind: OnAdapterBind<T>) : RecyclerView.Adapter<GeneralViewHolder<T>>() { override fun onCreateViewHolder(parent: ViewGroup, viewType:

Passing variable(position) from onBindViewHolder to ViewHolder class

蓝咒 提交于 2020-01-24 00:56:26
问题 I am trying to pass a String ( userID ) from the onBindViewHolder to my ViewHolder class. The reason behind this is that I need the position to allocate the correct postID. This postID is used in the ViewHolder as a reference to set up a Firebase valueEventListener . However, when running the app I get a NullPointerException on the postID. Is this due to synchronization? Is the valueEventListener called before postID is set? public void onBindViewHolder(RecyclerView.ViewHolder holder, int

RecyclerView - Get the selected position and pass the position to another activity where the same list will appear with that specific item selected

穿精又带淫゛_ 提交于 2020-01-23 12:25:23
问题 I have declared a ViewModel.class for the RecyclerView an Adapter and I have parsed to the MainActivity and to another Activity so I have the same adapter for both activities. I can show the parsed data in both activities but the problem it is I cannot take the data of the selected item to MainActivity and then to set to that btnSearch for a click so then I can share between activities the data from the selected item. Every time when the app is open the first item is selected. What I am

Double Click OnClickListener of a Recycler View Adapter

守給你的承諾、 提交于 2020-01-22 19:32:03
问题 I am trying to add a simple Click View to an item of a recycler view, but for some reason I have to click on an item twice instead of once to perform an action. On single click it seems like that recycler View does not detect a click. On the next one however it detects the click and performs a suitable action. XML : <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/cardView" android:layout_width="match_parent" android:layout_height

Double Click OnClickListener of a Recycler View Adapter

心不动则不痛 提交于 2020-01-22 19:31:46
问题 I am trying to add a simple Click View to an item of a recycler view, but for some reason I have to click on an item twice instead of once to perform an action. On single click it seems like that recycler View does not detect a click. On the next one however it detects the click and performs a suitable action. XML : <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/cardView" android:layout_width="match_parent" android:layout_height

Why my notifyItemChanged() change the wrong item of RV?

霸气de小男生 提交于 2020-01-16 19:37:48
问题 I have button at my RV item. After clicking I show progress bar and send request to my API. When response will be successful I would like to hide progress bar and change background of button. Here I click on my button: holder.ivAddTo.setOnClickListener { holder.progressBar.visibility = View.VISIBLE holder.ivAddTo.setBackgroundResource(R.drawable.added_to_notepad) holder.ivAddTo.visibility = View.GONE holder.ivAddTo.isClickable = false saveToNotepad(jobModel.id) } my api call method part: if