每当我调用用于从数据库中检索个人资料图像网址并使用该网址设置图像视图的函数时,应用程序就会崩溃。
private void displayImageInNav() {
mImage = (CircleImageView) findViewById(R.id.nav_image);
ref = FirebaseDatabase.getInstance().getReference().child("Users").child(mAuth.getCurrentUser().getUid())
.child("profileImageUrl");
ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(dataSnapshot.exists()){
switch(dataSnapshot.getValue().toString()){
case "default":
break;
default:
Glide.with(drawer.getContext()).load(dataSnapshot.getValue().toString()).into(mImage);
break;
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}