刚刚做了个调用系统分享功能的事件,点击按钮,进入图库,选择图片时调用系统的分享功能,出现个问题,直接进入qq界面分享到QQ,微信,微博其他的都没出来,求解,下面是代码
//调用图库
public void Getpic(){
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
intent.putExtra("crop", true);
intent.putExtra("return-data", true);
startActivityForResult(intent, 2);
}
//分享功能
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
System.out.println("requestCode"+requestCode);
if (requestCode == 2) {
Uri uri = data.getData();
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent,"分享到"));
}}
这里是按钮调用方法
public void eventOccured(int id) {
Log.i("sat", "Clicked on " + id);
if(id==1){
Getpic();
}