2016-07-22 20 views

回答

0

請以下URI

try{ 
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/fb_id_of_the_profile")); 
    startActivity(intent); 
    }catch(Exception e){ 
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/username))); 
    } 

嘗試用配置文件ID

+0

感謝您的回答。我試過Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(「fb:// profile/UserName」));但它只啓動Facebook應用程序。我沒有顯示給定用戶名的個人資料。 – fReeTaSte

+0

此網址在應用程序瀏覽器「https://www.facebook.com/username」中正常工作,但如果您想在Facebook android應用程序中查看個人資料,則應該在您的項目中遵循Facebook sdk集成。按照步驟[這裏](developers.facebook.com) – LvN

0

我解決了問題,請更換 「fb_id_of_the_profile」。我取代了代碼

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("fb://facewebmodal/f?href=https://facebook.com/Username")));

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("fb://facewebmodal/f?href=https://www.facebook.com/Username")));

相關問題