getUserInfo();
mProfileImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, 1);
}
⇈这是获取用户信息
private void getUserInfo() {
mCustomerDatabase.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.exists() && dataSnapshot.getChildrenCount()>0) {
Map<String, Object> map = (Map<String, Object>) dataSnapshot.getValue();
if (map.get("name")!= null) {
name = map.get("name").toString();
mNameField.setText(name);
}
if (map.get("phone")!= null) {
phone = map.get("phone").toString();
mPhoneField.setText(phone);
}
if (map.get("profileImageUrl")!=null) {
profileImageUrl = map.get("profileImageUrl").toString();
Glide.with(getApplication()).load(profileImageUrl).into(mProfileImage);
}
}
}
⇈我认为这部分有问题,因为我成功更新到Firebase后无法显示图像
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1 && resultCode == Activity.RESULT_OK){
final Uri imageUri = data.getData();
resultUri = imageUri;
mProfileImage.setImageURI(resultUri);
}
}