In android studio 1.4.1, I have created new Navigation Drawer Project which is default.My issue is in this project there is nav_header_main.xml file which is for navigation
FirebaseAuth firebaseauth = FirebaseAuth.getInstance();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); //displays text of header of nav drawer.
View headerview = navigationView.getHeaderView(0);
TextView tt1 = (TextView) headerview.findViewById(R.id.textview_username);
tt1.setText(firebaseauth.getCurrentUser().getDisplayName());//username of logged in user.
TextView tt = (TextView) headerview.findViewById(R.id.textView_emailid);
tt.setText(firebaseauth.getCurrentUser().getEmail()); //email id of logged in user.
final ImageView img1 = (ImageView) headerview.findViewById(R.id.imageView_userimage);
Glide.with(getApplicationContext())
.load(firebaseauth.getCurrentUser().getPhotoUrl()).asBitmap().atMost().error(R.drawable.ic_selfie_point_icon) //asbitmap after load always.
.into(new SimpleTarget() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation super Bitmap> glideAnimation) {
img1.setImageBitmap(resource);
}
});
I have made this code by myself with some logic...Its 100% working.....pls do upvote my ans.
The textview and imageview are from @layout/nav_header_main.xml