Я пытаюсь отобразить изображение профиля пользователя, который вошел в мое приложение. Это простое приложение, которое просто регистрирует кого-то и запускает действие logout
после успешного входа в систему. В действии выхода из системы я пытаюсь отобразить приветственное сообщение и изображение пользователя. Пока у меня есть приветственное сообщение для работы, определив метод onConnected()
в MainActivity
следующим образом:
public void onConnected(Bundle connectionHint) {
String accountName = mPlusClient.getAccountName();
Toast.makeText(this, accountName + " is connected.", Toast.LENGTH_LONG).show();
Intent startLogoutActivityIntent = new Intent(this, LogoutActivity.class);
startLogoutActivityIntent.putExtra("ACCOUNT_NAME", accountName);
if (mPlusClient.getCurrentPerson() != null) {
Person currentPerson = mPlusClient.getCurrentPerson();
String personName = currentPerson.getDisplayName();
String photo = currentPerson.getImage().getUrl();
String personGooglePlusProfile = currentPerson.getUrl();
startLogoutActivityIntent.putExtra("Profile_photo", photo);
}
startActivity(startLogoutActivityIntent);
}
и в моем классе LogoutActivity
я добавил эти строки
TextView message = (TextView) findViewById(R.id.welcomeMessage);
message.setText("Welcome to the DivingScores app " + in.getStringExtra
("ACCOUNT_NAME"));
ImageView profilePicture = (ImageView) findViewById(R.id.userImage);
Проблема в том, что я не знаю, какой метод вызывать с помощью profilePicture
. я пытался
profilePicture.setImageResource(in.getStringExtra("profile_photo"));
но я получаю ошибку
setImageResource (int) in ImageView cannot be applied to (java.lang.String).
Может кто-нибудь указать мне в правильном направлении?