[Solved] Arraylist become null
You have not set a LayoutManager to your RecyclerView: use this to set LayoutManager to your RecyclerView: mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); in oncreate 10 solved Arraylist become null
You have not set a LayoutManager to your RecyclerView: use this to set LayoutManager to your RecyclerView: mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); in oncreate 10 solved Arraylist become null
Use below layout as item of your RecyclerView <?xml version=”1.0″ encoding=”utf-8″?> <androidx.cardview.widget.CardView xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”wrap_content” app:cardCornerRadius=”15dp” app:cardMaxElevation=”3dp” android:elevation=”3dp” app:cardUseCompatPadding=”true” app:cardBackgroundColor=”@android:color/white”> <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”horizontal”> <LinearLayout android:layout_weight=”.95″ android:layout_width=”0dp” android:layout_height=”wrap_content” android:orientation=”vertical”> <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:padding=”15dp”> <TextView android:id=”@+id/tv_received_message_heading” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”Received Message:”/> <TextView android:id=”@+id/tv_received_message” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”First Received Message” android:layout_marginStart=”5dp”/> </LinearLayout> <View android:layout_width=”match_parent” android:layout_height=”1dp” android:background=”@color/colorPrimary” android:layout_marginStart=”10dp” … Read more
Assumning all items have similar views Try This: GridLayoutManager layoutManager = new GridLayoutManager(DashboardActivity.this, 2); layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { if (positions you wish to have a different view) { return 2; } return 1; } }); 2 solved How to display this type of view in recyclerview?
Try this in onBindViewHolder method: if (position==2)// position which you want to disable { holder.textView.setOnClickListener(null) }else { holder.textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // perform action here } }); } 2 solved Disable only one from the list Recyclerview in android [closed]
You’re calling LayoutInflater.from as if you were calling a constructor: LayoutInflater inflater = new LayoutInflater.from(parent.getContext()); That’s a mixture of constructor-call syntax (new) and method call syntax (.from). It would work if LayoutInflater.from were a static nested class, but it’s not… it’s just at static method. So you want: LayoutInflater inflater = LayoutInflater.from(parent.getContext()); solved can not … Read more
According to this question this is the best way to implement clicking on the item of RecyclerView Firstly create a file values/ids.xml and put this in it: <?xml version=”1.0″ encoding=”utf-8″?> <resources> <item name=”item_click_support” type=”id” /> </resources> then add the code below to your source for Java Copy the following helper class to your project public … Read more
I got Answer @Override public void onDataChanged() { if(dialog != null && dialog.isShowing()){ dialog.dismiss(); } if(getItemCount() == 0){ remoteListRV.setVisibility(View.GONE); msgTv.setVisibility(View.VISIBLE); msgTv.setText(“No “+ appType +” Available !!!!”); }else { remoteListRV.setVisibility(View.VISIBLE); msgTv.setVisibility(View.GONE); } } 0 solved If there is data in query or Path it show data in FirestoreRecyclerAdapter. but when there is no data at that … Read more
In your adapter class private static final int POSTER = 1; //for sliding item private static final int CHILDGROUP = 2; //normal items In getItemViewType() @Override public int getItemViewType(int position) { if (position == 0 ) return POSTER; else return CHILDGROUP; } In onCreateViewHolder() check which item & inflate layout as per item @Override public … Read more
You need to use add the OnRatingBarChangeListener to handle the OnRatingBarChanged event. Add the necesary code to the onBindViewHolder method: @Override public void onBindViewHolder(@NonNull FoodViewHolder foodViewHolder, int i) { FoodItem currentItem = arrayList.get(i); foodViewHolder.viewHolderImageView.setImageResource(currentItem.getFoodImage()); foodViewHolder.viewHolderTextView.setText(currentItem.getFoodName()); foodViewHolder.viewHolderRatigBar.setRating(currentItem.getFoodRating()); foodViewHolder.viewHolderRatigBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener(){ @Override public void onRatingBarChanged(RatingBar ratingBar, float rating, boolean fromUser){ currentItem.setFoodRating(rating); } } } NOTE: The value “rating” … Read more
Without any code from your end, what I can suggest is to do something like : recyclerView.post(new Runnable() { @Override public void run() { // Execute your AsyncTask here by providing Width } }); Because the problem I can guess is your RecyclerView is not properly inflated when you call the AsyncTask with width Also … Read more
It’s typically an inflation error. You would need to compare the View IDs that you are attempting to populate, make sure they are not null and that you are setup with your Recycler View Holder Adapter properly. Post your adapter, your xml for the row that you are filling, your viewholder pattern and your adapter … Read more
Please check the following xml for the background of each seekbar:- <?xml version=”1.0″ encoding=”utf-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:id=”@android:id/background” android:drawable=”@drawable/round_bg_progress”> <!– or 1dp –> </item> <item android:id=”@android:id/progress”> <clip android:drawable=”@drawable/seek1_bg” /> </item> </layer-list> 1 solved RecyclerView With Multiple Seekbars
Open activity_main.xml file in res/layout and copy the following content. <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”horizontal” android:paddingLeft=”5dp” tools:context=”.MainActivity” android:baselineAligned=”false” > <ListView android:id=”@+id/list_fruits” android:layout_width=”0dp” android:layout_height=”wrap_content” android:layout_weight=”1″ android:paddingRight=”5dp” > </ListView> <LinearLayout android:id=”@+id/side_index” android:layout_width=”50dp” android:layout_height=”fill_parent” android:background=”#c3c3c3″ android:gravity=”center_horizontal” android:orientation=”vertical” > </LinearLayout> Create a new side_index_item.xml file in res/layout and copy the following content. <?xml version=”1.0″ encoding=”utf-8″?> <TextView xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/side_list_item” … Read more
You just forgot to set Adapter to your mRecyclerViews check in your loadData() method check this line //mRecyclerViews.setAdapter(mAdapter); Try this private void loadData(){ mArrayList = new ArrayList<>(); mArrayList.add(new Model(“Constraint Layout”)); mArrayList.add(new Model(“Linear Layout”)); mArrayList.add(new Model(“Relative Layout”)); mArrayList.add(new Model(“Card View”)); mArrayList.add(new Model(“Scroll Views”)); mArrayList.add(new Model(“Grid View”)); mAdapter = new MyAdapter(mArrayList); mRecyclerViews.setAdapter(mAdapter); } EDIT You need to … Read more
You should save each date when you fill your recyclerView, maybe in a SQLite database, after that, you can check that register in onCreate() method of your activity, and add a condition (if has passed three days), if true, just refill it like this: mRecyclerAdapter = new mRecyclerAdapter(yourItemList); mRecyclerView.setAdapter(mRecyclerAdapter); mRecyclerView.getAdapter().notifyDataSetChanged(); After this, overwrite the date … Read more