Я пытаюсь загрузить изображение из хранилища Firebase с помощью Picasso в CircleImageView во фрагменте. но вместо загрузки изображения оно загружает изображение ошибки
Я использую CircleImageView из https://github.com/hdodenhof/CircleImageView
Это мой фрагмент_файла. xml файл
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_orange_light">
<TextView
android:id="@+id/update_profile_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:text="Update"
android:textColor="@android:color/white"
android:textSize="17sp"
android:textStyle="bold" />
<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="wrap_content"
android:layout_height="wrap_content"
tools:context=".HomeActivity"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true">
<TextView
android:id="@+id/verifyMsg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center_horizontal"
android:text="Email Not Verified!"
android:textColor="@android:color/holo_red_dark"
android:textSize="20dp"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="0dp" />
<Button
android:id="@+id/resendCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/verifyMsg"
android:layout_centerHorizontal="true"
android:layout_marginStart="8dp"
android:layout_marginTop="-1dp"
android:layout_marginEnd="8dp"
android:text="VERIFY NOW"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/verifyMsg" />
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/profile_image"
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_below="@+id/profile_top_text"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true"
app:civ_border_color="#FF000000"
app:civ_border_width="2dp" />
<TextView
android:id="@+id/profile_top_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/resendCode"
android:layout_centerHorizontal="true"
android:layout_marginTop="6dp"
android:gravity="center"
android:text="Your Profile"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/select_image_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/profile_image"
android:layout_marginTop="12dp"
android:text="Select Images"
android:textColor="@android:color/white"
android:textStyle="bold"
android:textSize="17dp"
android:layout_centerHorizontal="true"
app:layout_constraintStart_toEndOf="@+id/imageView2"
app:layout_constraintTop_toTopOf="@+id/imageView2" />
<TextView
android:id="@+id/profile_text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/select_image_button"
android:layout_marginTop="12dp"
android:text="Your Name"
android:layout_centerHorizontal="true"
app:layout_constraintStart_toEndOf="@+id/imageView2"
app:layout_constraintTop_toTopOf="@+id/imageView2" />
<TextView
android:id="@+id/profile_text_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/profile_text_name"
android:layout_centerHorizontal="true"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="Your Email Address"
app:layout_constraintStart_toEndOf="@+id/imageView2"
app:layout_constraintTop_toBottomOf="@+id/profile_text_username" />
<TextView
android:id="@+id/profile_text_phone_number"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="Phone Number"
android:layout_below="@id/profile_text_email"
android:layout_centerHorizontal="true"
app:layout_constraintStart_toEndOf="@+id/imageView2"
app:layout_constraintTop_toBottomOf="@+id/profile_text_email" />
<TextView
android:id="@+id/profile_text_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/profile_text_email"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="Usename"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/profile_text_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/profile_text_username"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="Phone"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/image23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/profile_text_phone"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="Phone"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</RelativeLayout>
и это мой ProfileFragment. java
package com.infinite.estudy;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.EventListener;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreException;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.StorageTask;
import com.google.firebase.storage.UploadTask;
import com.squareup.picasso.Picasso;
import com.theartofdev.edmodo.cropper.CropImage;
import com.theartofdev.edmodo.cropper.CropImageView;
import java.util.HashMap;
import java.util.Map;
import de.hdodenhof.circleimageview.CircleImageView;
public class ProfileFragment extends Fragment {
TextView fullName, username, email, phoneNumber, verifyMsg, selectImageButton, updateProfileButton, image;
FirebaseAuth fAuth;
FirebaseFirestore fStore;
String userID, myUrl;
Button resendCode;
StorageReference storageReference;
CircleImageView profileImageView;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_profile, container, false);
Context c = getActivity().getApplicationContext();
fullName = v.findViewById(R.id.profile_text_name);
username = v.findViewById(R.id.profile_text_username);
email = v.findViewById(R.id.profile_text_email);
phoneNumber = v.findViewById(R.id.profile_text_phone);
selectImageButton = v.findViewById(R.id.select_image_button);
profileImageView = v.findViewById(R.id.profile_image);
updateProfileButton = v.findViewById(R.id.update_profile_btn);
image = v.findViewById(R.id.image23);
fAuth = FirebaseAuth.getInstance();
fStore = FirebaseFirestore.getInstance();
storageReference = FirebaseStorage.getInstance().getReference();
resendCode = v.findViewById(R.id.resendCode);
verifyMsg = v.findViewById(R.id.verifyMsg);
userID = fAuth.getCurrentUser().getUid();
final FirebaseUser user = fAuth.getCurrentUser();
selectImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
}
});
updateProfileButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = (new Intent(getActivity(), EditProfileActivity.class));
startActivity(intent);
}
});
DocumentReference documentReference = fStore.collection("Users").document(userID);
documentReference.addSnapshotListener(getActivity(),new EventListener<DocumentSnapshot>() {
@Override
public void onEvent(@Nullable DocumentSnapshot documentSnapshot, @Nullable FirebaseFirestoreException e) {
email.setText("Email: " + documentSnapshot.getString("email"));
fullName.setText("Name: " + documentSnapshot.getString("fName"));
phoneNumber.setText("Phone Number: " + documentSnapshot.getString("phoneNumber"));
username.setText("Username: " + documentSnapshot.getString("username"));
image.setText("image:" + documentSnapshot.getString("image"));
}
});
myUrl = image.getText().toString();
Picasso.get().load(myUrl)
.placeholder(R.drawable.ic_profile).error(R.drawable.ic_logout)
.into(profileImageView);
if(!user.isEmailVerified()){
resendCode.setVisibility(View.VISIBLE);
verifyMsg.setVisibility(View.VISIBLE);
resendCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
user.sendEmailVerification().addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(view.getContext(), "Verification Email Has Been Sent", Toast.LENGTH_SHORT).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d("tag","onFailure: Email not sent" + e.getMessage());
}
});
}
});
}
else
{
resendCode.setVisibility(View.GONE);
verifyMsg.setVisibility(View.GONE);
}
return v;
}
}