im trying to show view layout which it's xml layout while performing api request and remove it after the request is done the layout contains TextView and animation and after the layout is showing i need to set TextView to random text
<RelativeLayout 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="#091A24">
<com.airbnb.lottie.LottieAnimationView
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_above="@+id/loading_splashscreenText"
app:lottie_autoPlay="true"
android:layout_marginBottom="15dp"
android:id="@+id/lottiLoadingProgress"
app:lottie_loop="true"/>
<TextView
android:id="@+id/loading_splashscreenText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="35dp"
android:layout_marginRight="35dp"
android:background="@color/black"
android:fontFamily="@font/outfitsemibold"
android:padding="5dp"
android:text="Loading ... "
android:textColor="@color/white"
android:textSize="16dp" />
</RelativeLayout>
here's my layout and i need to access the textview by its id after the layout is showing
XML File
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--Keep your layout here-->
</RelativeLayout>
<RelativeLayout
android:id="@+id/RLProgress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#77000000">
<com.airbnb.lottie.LottieAnimationView
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_above="@+id/loading_splashscreenText"
app:lottie_autoPlay="true"
android:layout_marginBottom="15dp"
android:id="@+id/lottiLoadingProgress"
app:lottie_loop="true"/>
<TextView
android:id="@+id/loading_splashscreenText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="35dp"
android:layout_marginRight="35dp"
android:background="@color/ColorBlack"
android:padding="5dp"
android:text="Loading ... "
android:textColor="@color/color_white"
android:textSize="16dp" />
</RelativeLayout>
</FrameLayout>
API Function
private void callAPI() {
RLProgress.setVisibility(View.VISIBLE);
Interface.callAPI("api_url").enqueue(new Callback<Model>() {
@Override
public void onResponse(Call<Model> call, Response<Model> response) {
RLProgress.setVisibility(View.GONE);
}
@Override
public void onFailure(Call<Model> call, Throwable t) {
RLProgress.setVisibility(View.GONE);
}
});
}