在Android App里想向别的程序分享二进制文件很简单,下面是段分享声音文件的例子。
1 2 3 4 5 |
Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.setType("audio/*"); shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///" + recorder.getFileName())); // 但到声音文件的地址 startActivity(Intent.createChooser(shareIntent, "Share my words during sleeping")); |