如何使用uri
解析de.hdodenhof.circleimageview.CircleImageView
?
我的代码
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();
}
感谢您的回复!
答案 0 :(得分:0)
自CircleImageView
is a subclass of ImageView
以来,它继承了properties/methods from ImageView
的大部分内容。
不幸的是,似乎是ImageView doesn't expose its source URI,因此您必须保留传递到CircleImageView
周围的URI。