Android之调用系统分享
生活随笔
收集整理的這篇文章主要介紹了
Android之调用系统分享
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1、調用系統分享關鍵代碼
private void shareImage() {Intent intent = new Intent(Intent.ACTION_SEND); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("sdcard/screenshot.png")));intent.setType("image/*");startActivity(Intent.createChooser(intent,"share image"));}private void shareZip() {Intent intent = new Intent(Intent.ACTION_SEND); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File("sdcard/androidLog_2017-05-17_15-49-52.zip")));intent.setType("application/zip"); startActivity(Intent.createChooser(intent,"share zip"));}
2、運行結果圖片
總結
以上是生活随笔為你收集整理的Android之调用系统分享的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android之HandlerThrea
- 下一篇: Android之项目全部能正常登录但是部