Android—— 调用系统的实现分享

/**

*弹出分享列表

*/

private voidshowShareDialog(){

AlertDialog.Builder builder =newAlertDialog.Builder(getActivity());

builder.setTitle("选择分享类型");

builder.setItems(newString[]{"短信","其他"}, newDialogInterface.OnClickListener() {

@Override

public voidonClick(DialogInterface dialog, intwhich) {

//TODO Auto-generated method stub

dialog.dismiss();

switch(which) {

case0:

sendSMS("http://www.xckjetc.com/");

break;

case1:

Intent intent=newIntent(Intent.ACTION_SEND);

intent.setType("text/plain");

intent.putExtra(Intent.EXTRA_SUBJECT,"分享");

intent.putExtra(Intent.EXTRA_TEXT,"分享我们的app下载连接连接,后台提供,待添加。。。。。百度:"+"http://www.baidu.com/");

intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

startActivity(Intent.createChooser(intent,"分享"));

break;

default:

break;

}

}

});

builder.setNegativeButton("取消",  newDialogInterface.OnClickListener() {

@Override

public  voidonClick(DialogInterface dialog,  intwhich) {

dialog.dismiss();

}

});

builder.create().show();

}

你可能感兴趣的:(Android—— 调用系统的实现分享)