How to save current scroll position for RecyclerView on item deletes?

I have a chat RecyclerView, I want to prevent RecyclerView from auto scrolling to last item on item deleted. I want to make the smooth scroll only on activity starts. Below, a code samples for setting up the RecyclerView and the message deleting process. If anyone can help me. Thank you… Setting RecyclerView private fun… Read More How to save current scroll position for RecyclerView on item deletes?

TextView inside RecyclerView not scrolling

I have a TextView that is inside a RecyclerView and those are both inside a fragment. When I try to scroll the Textview it just scrolls the RecyclerView instead. Fragment Code <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android&quot; xmlns:app="http://schemas.android.com/apk/res-auto&quot; xmlns:tools="http://schemas.android.com/tools&quot; android:layout_width="match_parent" android:layout_height="match_parent"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/drink_recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="100dp" /> <Button android:id="@+id/rndDrinkBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="25dp" android:text="@string/random_drink" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"… Read More TextView inside RecyclerView not scrolling

How to call ArrayList<String> in Adapter?

i have a problem here. i want to call an array string in my adapter, but the image not showing at all. and its say class com.bumptech.glide.load.engine.GlideException: Failed to load resource, com.bumptech.glide.Registry$NoModelLoaderAvailableException(Failed to find any ModelLoaders registered for model class: class java.util.ArrayList). Can someone help me? this is the Response data class ProductResponse ( @SerializedName("status"… Read More How to call ArrayList<String> in Adapter?

Value Event Listener returning data of only child of Root Node

I am trying to get data from firebase database. the realtime database has following json data {"Users": { "m7jnhJgBg3etM7Tmq1YUyV8C4F83": { "-NCcfP3bwRGtQnMWdKbN": { "avery": "aa", "birdage": "aa", "birdname": "aa", "birdring": "aa", "desc": "aa", "phonno": "aa" } }, "yIp99CWgApYzuU7lMZC3UwrpFIl1": { "-NCclsCkUA4xIA_T7yn3": { "avery": "bb", "birdage": "bb", "birdname": "bb", "birdring": "bb", "desc": "bb", "phonno": "bb" }, "-NCclxfFhRNaQJKzYlKw": {… Read More Value Event Listener returning data of only child of Root Node

Can't pass data from recyclerview adapter to another kotlin fragment

I’m trying to move from activities to fragments In old activity app when the user clicks on the item he is going to a new activity with item data Now i need same thing in fragment Here’s my adapter code override fun onBindViewHolder(holder: PhotosHolder, position: Int) { val productPhoto = photosArrayList[position] val key = productPhoto.key… Read More Can't pass data from recyclerview adapter to another kotlin fragment

"Empty list doesn't contain element at index 0" error when implementing Android Recycler View with checkbox

I am implementing a recycler view with it’s items as checkbox. My data is coming from ROOM database and this recycler view is inside a dialog fragment. Dialog Fragment : override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { _binding = ScheduleFloorDialogBinding.inflate(layoutInflater) createProfileViewModel = CreateProfileViewModel(Application()) floorProfileDialogAdapter = FloorProfileDialogAdapter() binding.rvFloorsForScheduling.layoutManager = LinearLayoutManager(requireActivity()) binding.rvFloorsForScheduling.adapter… Read More "Empty list doesn't contain element at index 0" error when implementing Android Recycler View with checkbox

Why is the recycler view has NullPointerException in fragment?

so here is the code for my recycler view adapter, which is located at onCreate: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) databaseReference = FirebaseDatabase.getInstance().getReference("profilUsaha") auth = FirebaseAuth.getInstance() uid = auth.currentUser?.uid.toString() daftar_pesan_recycler_view.adapter = adapter listenForLatestMessages() arguments?.let { param1 = it.getString(ARG_PARAM1) param2 = it.getString(ARG_PARAM2) } } But somehow, the following error appears: 2022-07-20 00:29:23.872 17032-17032/com.example.gesit E/AndroidRuntime: FATAL… Read More Why is the recycler view has NullPointerException in fragment?

Add SwipeToRefresh to RecyclerView Android

Have activity page with following code: <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/swipeRefreshLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#00FFFFFF" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@+id/view" app:layout_constraintHorizontal_bias="0.0" > <androidx.recyclerview.widget.RecyclerView android:id="@+id/mainList" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#F0F2F5" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@+id/view" app:layout_constraintVertical_bias="0" tools:layout_editor_absoluteX="0dp" /> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> On my main activity.kt file, I have the following code but I am unsure where i need to put listenings etc. as I didn’t write this part of the… Read More Add SwipeToRefresh to RecyclerView Android