-
-
Save jcaiqueoliveira/9ea00f70f32a945621d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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