android-recyclerview

Cannot scroll RecyclerView inside a Fragment?

孤街浪徒 提交于 2020-01-25 11:49:08
问题 I am having troubles integrating a RecyclerView (using cardviews for the rows) inside a fragment. For some reason I cannot scroll the card view? Please, any suggestions? This is my app design: This is my fragment code: public class PageFragment2 extends Fragment { public static final String ARG_PAGE2 = "ARG_PAGE"; private int mPage2; public static PageFragment2 newInstance(int page) { Bundle args = new Bundle(); args.putInt(ARG_PAGE2, page); PageFragment2 fragment = new PageFragment2();

How to disable button in RecyclerView and from AsyncTask

让人想犯罪 __ 提交于 2020-01-25 09:32:07
问题 I am trying to disable button after click in RecyclerView from Retrofit response. Application is using RecyclerView to populate list and I am using Retrofit to communicate to back-end REST API. There are two buttons inside one item and Retrofit client is activated on click. And if response from API is successful button should be disabled. I came across on two problems: first few items works just fine, but after few scrolls buttons I have never clicked on are disabled also; second was that

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

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:

Recyclerview Item onclick overlays the next fragment instead of replacing it

六月ゝ 毕业季﹏ 提交于 2020-01-25 06:43:30
问题 I have these activity, fragments, its viewmodels, and their adapter. I can already call the next fragment on click of a recyclerview item, but the new fragment overlays on the first fragment. Refer to screenshot below: Next screenshot is the old fragment view: As for the mainactivity: class MainActivity : AppCompatActivity(), RecyclerViewClickListener { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val navView:

Why my android activity is crashing with “No adapter attached; skipping layout” but sporadically?

六月ゝ 毕业季﹏ 提交于 2020-01-25 06:23:51
问题 I'm working on an android application, that is a messaging application actually. I'm using RecyclerView to render content of a particular conversation. What I'm stuck with is, I have a fragment that takes input from user to create a new conversation, I use that information to launch an activity for that conversation, to update its layout, adapter for the RecyclerView etc. I dismiss the fragment when user input is valid(not empty etc.), send a test message in the conversation and use the

Why my android activity is crashing with “No adapter attached; skipping layout” but sporadically?

戏子无情 提交于 2020-01-25 06:23:05
问题 I'm working on an android application, that is a messaging application actually. I'm using RecyclerView to render content of a particular conversation. What I'm stuck with is, I have a fragment that takes input from user to create a new conversation, I use that information to launch an activity for that conversation, to update its layout, adapter for the RecyclerView etc. I dismiss the fragment when user input is valid(not empty etc.), send a test message in the conversation and use the

About random result for query in Firestore

限于喜欢 提交于 2020-01-25 02:59:05
问题 I have a database in Firestore and RecycleView to put the data from it. I send some query to Firestore and it get me the result depending on my request. But what, if I want to take 3 random results from the set issued to me on request. That is I get, for example, 20 results and want to take only 3 result each time when I send a request. And each time, it must be random 3 results from this 20? I found there only one solution of the same problem: FirebaseFirestore rootRef = FirebaseFirestore

How to start activity from RecyclerView adapter in fragment [duplicate]

假如想象 提交于 2020-01-24 22:46:30
问题 This question already has answers here : Get application context from non activity singleton class (3 answers) Closed 2 years ago . I can't click RecyclerView to a new Activity from RecyclerViewAdapter . I call ItemClick here. DayAdapter.java : holder.setItemClickListener(new ItemClickListener() { @Override public void onClick(View view, int position, boolean isLongClick) { openProgramActivity(view, position); } }); } This function opens a new Activity : public void openProgramActivity(View

Error inflating class android.support.v7.widget.RecyclerView(Eclipse)

心不动则不痛 提交于 2020-01-24 22:22:46
问题 I want use android.support.v7.widget.RecyclerView in my android project in eclipse <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin