android-recyclerview

Android - RecyclerView NullPointerException getItemCount?

馋奶兔 提交于 2019-12-13 17:18:13
问题 I have a recyclerView that it get me crash : Here is my StartActivity : public class StartActivity extends AppCompatActivity { TextView txtTest; private ProgressDialog pDialog; // These tags will be used to cancel the requests private String tag_json_obj = "jobj_req", tag_json_arry = "jarray_req"; private RecyclerView.Adapter mAdapter; RecyclerView UserCode_Recycler; private LinearLayoutManager mLayoutManager; List<Marketing_Code> userCodeList; @Override protected void onCreate(Bundle

Problems using RecyclerView with StaggeredLayoutManager

痞子三分冷 提交于 2019-12-13 16:47:18
问题 I succesfully implemented RecyclerView using StaggeredLayoutManager with 2 col/spans. I have variable heighted items in each col, heights are not fixed. Problem is, when I scroll down and up in RecyclerView, sometimes a gap is occured at the top item of one of the rows. I added a video describing my problem. I simply added a StaggeredLayout with span value 2, and adapted my items with an adapter. +-+-+-+-+-+-+-+-+-+-+-+-+ <------ Top of RecyclerView -------------- <- Top item in left column -

Item views are not measured correctly when recycled in the RecyclerView

雨燕双飞 提交于 2019-12-13 16:17:43
问题 I have a scenario where, when views are recycled, the layout is incorrect. My row item layouts are as follows (note the wrap_content LinearLayout width, weight , and ellipsize ): <LinearLayout android:id="@+id/header" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:id="@+id/text1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:ellipsize="middle" android:singleLine=

RecyclerView notifyDataSetChanged not working after Parse query

别来无恙 提交于 2019-12-13 14:47:51
问题 I'm in a fragment trying to updated my recycler view, after querying Parse for some data. In the done method of the query I call notifyDataSetChagned , but the list is never displayed package com.garciaericn.t2d.fragments; public class DevicesCardViewFragment extends Fragment implements View.OnClickListener { private OnFragmentInteractionListener mListener; private BatteryHelper mBatteryHelper; Intent mBatteryStatus; private RecyclerView mRecyclerView; private DeviceAdapter mAdapter; private

Adding progressbar at the end of recyclerview

こ雲淡風輕ζ 提交于 2019-12-13 13:13:27
问题 In my app, I send a volley request which fetches list items one-by-one, not all at once. I want to implement a progressbar at the end of the recyclerview when the data is being fetched. The class 'updateAdapter' updates the adapter and I was thinking of making the progress bar visible in the recyclerview scroll listener. But I have no idea how to do this in my code. updateAdapter.java //THIS CLASS UPDATES THE RECYCLER VIEW public class updateAdapter{ private FetchWpApi fetch; private int

RecyclerView log statement: W/RecyclerView: RecyclerView does not support scrolling to an absolute position. Use scrollToPosition instead

谁说胖子不能爱 提交于 2019-12-13 13:09:10
问题 I am updating an old Android project, and now I am getting this log statement from RecyclerView repeatedly: W/RecyclerView: RecyclerView does not support scrolling to an absolute position. Use scrollToPosition instead It occurs when the recyclerview is populated and displayed for the first time or when the items in the recyclerview are refreshed. Logcat: 11-05 14:02:23.290 20209-20209/com.mydomain W/RecyclerView: RecyclerView does not support scrolling to an absolute position. Use

Onclick for each button inside RecyclerView items

核能气质少年 提交于 2019-12-13 12:47:06
问题 How to get the position for clicked button inside the RecyclerView items Here's my onBindViewHolder : public void onBindViewHolder(MyViewHolder holder, int position) { Masar masar=masrList.get(position); holder.masarName.setText(masar.getMasarTitle()); holder.masarDesc.setText(masar.getMasarDescreption()); //How to get the Position holder.masarImg.setImageResource(masar.getMasarImg()); holder.mapBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v ) { //if

How to swipe to delete on RecyclerView?

孤人 提交于 2019-12-13 12:08:39
问题 What I have here a History page that displays the requests the user have accepted or posted. I was able to successfully put a button for the user to delete all of the history the user has. Now I want the user to be able to delete a history one at a time by swiping it. HistoryFragment.java RecyclerView rView; Button clear; DatabaseReference dRef; LinearLayoutManager llm; String id; View myView; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle

Attempt to invoke interface method 'int java.util.List.size()' on a null object How Solve It? [duplicate]

别等时光非礼了梦想. 提交于 2019-12-13 11:30:55
问题 This question already has answers here : What is a NullPointerException, and how do I fix it? (12 answers) Closed last year . Error logs - java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference at in.hareshsaliya.itijobs.Adapter.ListSourceAdapter.getItemCount(ListSourceAdapter.java:115) at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3603) at android.support.v7.widget.RecyclerView.dispatchLayout

recyclerview not showing data?

怎甘沉沦 提交于 2019-12-13 11:25:36
问题 I am developing news app I am new to MVVM and I have implemented Kotlin coroutines and Koin with ViewModel hosted RecyclerView in fragment class but data not showing only progress bar loading below my screenshot I have posted my code to gist my code on gist below my code where I have implemented recyclerview and viewmodel logic class TopHeadlinesFragment : Fragment() { private val viewModel: MainViewModel by viewModel() private lateinit var topHeadlinesAdapter: TopHeadlinesAdapter //3