显示已安装的分享软件

1. Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SEND);
intent.setType("image/*");
            try {
                startActivity(Intent.createChooser(
                        intent, getText(R.string.send_media_files)));
            } catch (android.content.ActivityNotFoundException ex) {
                Toast.makeText(this, R.string.no_way_to_share,
                        Toast.LENGTH_SHORT).show();
            }
2.如果想自己做为分享应用可以在manifest.xml中添加
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>

你可能感兴趣的:(android,xml)