Skip to content

Instantly share code, notes, and snippets.

@jcaiqueoliveira
Last active March 17, 2016 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcaiqueoliveira/9ea00f70f32a945621d7 to your computer and use it in GitHub Desktop.
Save jcaiqueoliveira/9ea00f70f32a945621d7 to your computer and use it in GitHub Desktop.
//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