I'm trying to stop the progress bar after getting response from server. Below is the xml code that I've used
activity.xml
<ProgressBar
android:layout_weight="1"
android:id="@+id/progressBar"
android:indeterminate="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="40dp"
android:minWidth="40dp"
tools:ignore="MissingConstraints" />
activity.kt
var progressBar = findViewById(R.id.progressBar) as ProgressBar
doAsync {
try {
progressBar.setVisibility(View.VISIBLE);
appList = getAppList(requestBody, LAUNCHER_BASE_URL)
Log.d("App list =", appList.toString())
appInfoList = populateList()
progressBar.setVisibility(View.GONE);
} catch (e: Exception) {
progressBar.setVisibility(View.GONE);
Log.e("Exception-launcher", e.toString())
}
From the above code,progress bar is not stopping even after getting the response. Any help would be appreciated
I've tried that but the page becomes blank after the progress bar stops