当前位置: 代码迷 >> Android >> android 分享效能
  详细解决方案

android 分享效能

热度:14   发布时间:2016-04-28 07:58:11.0
android 分享功能

android的分享功能,是利用action实现的。

Intent intent = new Intent(Intent.ACTION_SEND);intent.setType("image/png"); // 分享的数据类型intent.putExtra(Intent.EXTRA_SUBJECT, title_tv.getText().toString()); // 主题intent.putExtra(Intent.EXTRA_TEXT, blurb_tb.getText().toString()); // 内容File f = new File(getItem(pos).getTitleIconLocalUrl());intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f)); // 圖片intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(Intent.createChooser(intent, "标题"));

如果图片分享的时候不显示,有可能是你的本地图片在保存的时候使用了私有,需要重新写一下代码

FileOutputStream outStream = openFileOutput(fileName, Context.MODE_WORLD_READABLE);

只读就行了

  相关解决方案