19、内容共享

 将数据发送给其他程序

向其他应用程序发送文本数据

Intent sendIntent = new Intent();

sendIntent.setAction(Intent.ACTION_SEND);

sendIntent.putExtra(Intent.EXTRA_TEXT, "要分享的文本数据");

sendIntent.setType("text/plain");

startActivity(sendIntent); 

 接收数据

接收文本/图像数据数据 

if (Intent.ACTION_SEND.equals(action) && type != null) {

    if ("text/plain".equals(type)) {

           handleSendText(intent);
    } else if (type.startsWith("image/")) {

          handleSendImage(intent);

    }

 内容分享 

posted on 2014-08-22 17:38  大米稀饭  阅读(171)  评论(0)    收藏  举报