0

How do I Parse uri with de.hdodenhof.circleimageview.CircleImageView?

Error.png

My code

 protected void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {

    final Uri uri = data.getData();

    StorageReference path = mStoragereference.child("Photos").child(uri.getLastPathSegment());


    path.putFile(uri).addOnSuccessListener(new OnSuccessListener < UploadTask.TaskSnapshot > () {
        @Override
        public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {

            FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();

            UserProfileChangeRequest profileUpdate = new UserProfileChangeRequest.Builder()
                .setPhotoUri(Uri.parse(userPhoto))
                .build();

            if (userPhoto == null) {
              Toast.makeText(EditInfo.this, "Error updating image",
                             Toast.LENGTH_SHORT).show();
            }

Thanks for your response!

Stphane
  • 3,368
  • 5
  • 32
  • 47
neil tan
  • 11
  • 4

1 Answers1

0

Since CircleImageView is a subclass of ImageView it inherits most of its properties/methods from ImageView.

Unfortunately it seems that ImageView doesn't expose its source URI, so you'll have to keep the URI that you pass into the CircleImageView around.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807