2014-04-12 41 views
9

我想分享一個文件中使用共享意向(.PDF,.apk文件等),我搜索谷歌,但我只找到了代碼共享圖片如何共享文件中的Android編程方式

Intent sharingIntent = new Intent(Intent.ACTION_SEND); 
Uri screenshotUri = Uri.parse(path); 
sharingIntent.setType("image/png"); 
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri); 
startActivity(Intent.createChooser(sharingIntent, "Share image using")); 

請幫助解決此問題

回答

13

您使用相同的代碼,您只需更改您希望共享的數據類型的MIME類型。如果您想分享任何類型的東西,請使用*/*

相關問題