I have a Main Activity with a button, pressing that button opens a second Activity. This second Activity loads a large amount of data from Firebase to a RecyclerView that takes some time. When I clicked on the Main Activity button, I wanted to open a page with a Progress Bar (without showing the percentage) and only when the second Activity was completely loaded did the Progress Bar close and show the content of the second Activity. What is the best way to do this? Any idea? Thanks.
Use ProgressBar
in xml layout file(in the fragment/activity where you need to display), like this
<RelativeLayout
android:id="@+id/progressLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
and in the associated activity file, set the visibility to GONE
.
do this where you called a method to load data.
progressLayout.visibility = View.GONE
if you can add that part of the code to your question, then it will be easier to help.