簡體   English   中英

如何將文本從Android應用共享到Facebook?

[英]How to share text from android app to facebook?

我嘗試在我的Android應用中實現共享按鈕以在Facebook中共享代碼:

facebook.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent share = new Intent(android.content.Intent.ACTION_SEND);
                share.setType("text/plain");
                share.putExtra(Intent.EXTRA_SUBJECT,desc.getText().toString());
                startActivity(Intent.createChooser(share, "Share description using"));


            }
        });

問題是,在facebook的發布對話框中,沒有顯示我需要從我的應用程序(desc.getText()。toString())共享的文本。 有空信息! 為什么文本沒有出現!

提前致謝

試試這個。 希望對你有幫助

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "Share Something");
startActivity(Intent.createChooser(intent, "Share with"));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM