简体   繁体   中英

ANDROID share to facebook, twitter etc using share intent

I search through the web and found this sharing to facebook, twitter or email by using the share intent. This share intent is it suppose to have those facebook, twitter icon there to select for sharing? When i run in emulator, it writes no application can run this action. Is it the sharing cannot be run in emulator or my code is not completely done.

Below is my code

btnShare.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
                Intent sharingIntent = new Intent(Intent.ACTION_SEND);
                sharingIntent.setType("plain/text");
                sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,
                        "This is the text that will be shared.");
                startActivity(Intent.createChooser(sharingIntent,
                        "Share via"));
        }
    });

The emulator has no Apps installed that can handle the share Intent. Therefore no App will be shown. If you don't have a Android device at hand you could try to download the Amazon Appstore or the Androidpit market application to your emulator and install sharing apps through this markets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM