я выполнил вход в facebook, но я не знаю, как получить адрес электронной почты и отобразить его в другой форме
Итак, это код
private void nextActivity(Profile profile){
if(profile != null){
Intent main = new Intent(LogInTo.this, SetUsername.class);
main.putExtra("name", profile.getFirstName());
main.putExtra("surname", profile.getLastName());
//main.putExtra("email", profile.get());
main.putExtra("imageUrl",
profile.getProfilePictureUri(200,200).toString());
startActivity(main);
finish();
}
}
Это мой обратный вызов
LoginButton loginButton = (LoginButton)findViewById(R.id.loginButton);
FacebookCallback<LoginResult> callback = new
FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Profile profile = Profile.getCurrentProfile();
nextActivity(profile);
Toast.makeText(getApplicationContext(), "Logging in...", Toast.LENGTH_SHORT).show();
}
@Override
public void onCancel() {
}
@Override
public void onError(FacebookException e) {
}
};
loginButton.setReadPermissions(Arrays.asList("user_friends"));
loginButton.registerCallback(callbackManager, callback);
И это код в другой форме, где показан адрес электронной почты, который вы получаете от facebook
Bundle inbundle = getIntent().getExtras();
String name = inbundle.get("name").toString();
String surname = inbundle.get("surname").toString();
FbFullname = (EditText) findViewById(R.id.fbfullname);
FbFullname.setText("" + name + " " + surname);
FbUsername = (EditText) findViewById(R.id.fbusername);
FbType = (EditText) findViewById(R.id.fbtype);
FbEmail = (EditText) findViewById(R.id.fbemail);