android - How to set profile picture obtained from facebook login to user profile in another activity -
i using facebook login in application. using profile
class basic user info name, profile picture. here code snippet of method updateui()
using update ui in login activity.
private void updateui() { boolean enablebuttons = accesstoken.getcurrentaccesstoken() != null; profile profile = profile.getcurrentprofile(); if (enablebuttons && profile != null) { profilepictureview.setprofileid(profile.getid()); toast.maketext(login.this,"login success", toast.length_short).show(); greeting.settext(profile.getname()); url.settext(profile.getprofilepictureuri(60,60).tostring()); } else { profilepictureview.setprofileid(null); greeting.settext(null); url.settext(null); } }
now want pass profile picture activity , set there rounded thumbnail. want know how that. here code of profile section in activity want set image. have put drawable
resource there.
drawer.addprofile( new drawerprofile() .setid(1) .setroundedavatar((bitmapdrawable) getresources().getdrawable(r.drawable.appeti)) .setbackground(getresources().getdrawable(r.drawable.ghewar)) .setname(getstring(r.string.welcome)) .setdescription(name) .setonprofileclicklistener(new drawerprofile.onprofileclicklistener() { @override public void onclick(drawerprofile drawerprofile, long id) { toast.maketext(home.this, "clicked profile #" + id, toast.length_short).show(); intent login = new intent(getapplicationcontext(),login.class); startactivity(login); } }) );
i using materialdrawer library of github show profile in navigation drawer in other activity. 1 way can think url of profile picture can url
text field shown in method updateui()
, pass through intent
activity. don't know how use url set thumbnail in drawer profile. appreciated. in advance.
the simple solution can think of can use libraries picasso or volley fetch image url , load directly imageview
the code using picasso library
picasso.with(context).load("facebook_profile_picture_url").into(imageview);
just 1 line of code
regarding volley library requires setup first.
Comments
Post a Comment