android share file (via bluetooth, email,,,,)
1 Intent intent = new Intent(Intent.ACTION_SEND);
2 intent.setType("*/*");
3 // intent.setType("image/png");
4 intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/test.docx")));
5 startActivity(Intent.createChooser(intent, "Share File"));
2 intent.setType("*/*");
3 // intent.setType("image/png");
4 intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("/sdcard/test.docx")));
5 startActivity(Intent.createChooser(intent, "Share File"));
蓝牙,gmail, email等支持的MIMI Type可能不一样,如果不考虑mimi type, 直接使用 */* 即可,也可以参考:
Bluetooth:
http://www.google.com/codesearch/p?hl=en#cZwlSNS7aEw/packages/apps/Bluetooth/AndroidManifest.xml
Email:
http://www.google.com/codesearch/p?hl=en#cZwlSNS7aEw/packages/apps/Email/AndroidManifest.xml