我已經實施Facebook登錄到我的應用程序,現在想要獲得用戶個人資料圖片,我已經做了這個,但我現在試圖把它變成一個圓形格式使用此庫 - https://github.com/vinc3m1/RoundedImageView獲取用戶個人資料圖片圈圖像視圖
我有實現兩者結合起來麻煩,我不知道最好的方式去解決它
這裏是java
final RoundedImageView profilePic = (RoundedImageView) rootView.findViewById(R.id.myProfilePic);
GraphRequestAsyncTask request = GraphRequest.newMeRequest(AccessToken.getCurrentAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject user, GraphResponse response) {
if (user != null) {
// set the profile picture using their Facebook ID
profilePic.setProfileId(user.optString("id"));
}
}
}).executeAsync();
這裏是XML
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/myProfilePic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_gravity="center_horizontal"
android:padding="10dip"
android:scaleType="center"
app:riv_corner_radius="30dip"
app:riv_border_width="3dip"
app:riv_oval="false"
app:riv_border_color="@color/material_white"
/>
我收到錯誤
無法解析法「SetProfileId」
我認爲錯誤是因爲我沒有在圖形請求返回了相應的位圖,但不知道如何解決此問題。
感謝您的回覆,我很感興趣,下載它自己,因爲我認爲這將是更容易與工作,但我無法找到任何信息如何做到這一點。你認爲做這件事最好的方法是什麼? –
看看你如何使用圖形API獲取URL - https://developers.facebook.com/docs/graph-api/reference/profile-picture-source/ –
Thankyou幫助我實際上設法通過獲取通過Graph Request的uri,然後將其提交給Facebooks壁畫,該壁紙具有用於將圖像轉換爲圓形的內置方法。 –