Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//requisição para carregar imagem
private class LoadImage extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
try {
URL profile_pic = new URL("https://graph.facebook.com/" + AccessToken.getCurrentAccessToken().getUserId() + "/picture?width=76&height=76");
final Bitmap mIcon_val = BitmapFactory.decodeStream(profile_pic.openConnection().getInputStream());
runOnUiThread(new Runnable() {
@Override
public void run() {
imageProfile.setImageBitmap(mIcon_val);
}
});
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
//obtendo nome usuário
private void userName() {
boolean enableButtons = AccessToken.getCurrentAccessToken() != null;
Profile profile = Profile.getCurrentProfile();
if (profile == null) {
Log.e("Profile", "null");
}
if (enableButtons && profile != null) {
nameProfile.setText(profile.getName());
Log.i("Token", AccessToken.getCurrentAccessToken().getUserId());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.