This layout takes around 60 seconds to show up on screen but scrolling is fast as soon as it is done. The app freezes whilst this happens and works okay as soon as the the items of the lists show up on screen.I am loading around 400 contacts for the one list and around 10 for the second.This could vary since some phones could have more or less the number of contacts.
I also have this search/filter mechanism to show contacts that match a query. It works but updating the recyclerviews takes a very long time.
I am updating both recyclerviews according to the same filter/query.
What could be causing this slowdown?
How can I improve the time it takes for the layout to show/render on screen?
I used mKambaContactsListView?.isNestedScrollingEnabled = false and that helped improved the scrolling performance.
Any help would be appreciated.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
app:title="@string/title_pagar">
<include
android:id="@+id/olo"
layout="@layout/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="60dp"
tools:context="tetst.com.contactstest.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="900dp">
<android.support.constraint.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent"
app:layout_constraintVertical_bias="0.006">
<android.support.v7.widget.RecyclerView
android:id="@+id/kambaContactList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="true"
android:clipToPadding="true"
app:layout_constraintBottom_toTopOf="@+id/local_tv"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/kamba_tv"
tools:listitem="@layout/kamba_contacts_item_layout" />
<android.support.v7.widget.RecyclerView
android:id="@+id/contactList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:clipChildren="true"
android:clipToPadding="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/local_tv"
tools:listitem="@layout/contacts_item_layout" />
<TextView
android:id="@+id/local_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:paddingTop="8dp"
android:text="@string/local_contacts"
android:textAllCaps="true"
android:textColor="@color/text_dark_grey"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/contactList"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/kambaContactList" />
<TextView
android:id="@+id/kamba_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:paddingTop="8dp"
android:text="Kambas"
android:textAllCaps="true"
android:textColor="@color/text_dark_grey"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</FrameLayout>**strong text**