I want to turn my progress bar / circle invisible when the images are loaded on the page, but the setVisibilty() doesn't exist anymore. What is the subistute, because I couldn't find anything on the internet.
I wanted to call it after the setAdapter().
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.notes_fragment, container, false);
BottomNavigationView bottomNav = view.findViewById(R.id.bottomAppBar);
MaterialToolbar topAppBar = view.findViewById(R.id.topAppBar);
bottomNav.setSelectedItemId(R.id.notes);
mProgressCircle = (ProgressBar) view.findViewById(R.id.progress_circle);
imageList = new ArrayList<>();
currentUser = mAuth.getCurrentUser();
mUserRef = storage.getReference().child(currentUser.getEmail());
gridView = view.findViewById(R.id.gridview);
mUserRef.listAll().addOnSuccessListener(new OnSuccessListener<ListResult>() {
@Override
public void onSuccess(ListResult listResult) {
for(StorageReference file:listResult.getItems()){
Log.w(TAG, file.toString());
file.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
imageList.add(uri.toString());
Log.w(TAG,"URI: " uri.toString());
}
}).addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
adpter = new GridAdapter(getActivity(), imageList);
gridView.setAdapter(adpter);
}
});
}
}
});
android:id="@ id/progress_circle"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="78dp"
android:layout_height="83dp"
android:layout_gravity="center"/>
CodePudding user response:
Can you please post the line with which you try to change the visibility, or do I not see it? Try to use:
setVisibility(View.INVISIBLE);
Reference: Android: why setVisibility(View.GONE); or setVisibility(View.INVISIBLE); do not work Visibility of ProgressBar