0

这是我尝试过的代码。我只是想通过彩信发送视频的文字和图片。但我只能发送文字,但图片没有附加。任何人都可以帮助我。我是新手这个。

ivbMessage.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        try {
            imageModel = videoDetails.getVideoImagesList().get(0);
            imageUrl = imageModel.getUrl();
            System.out.println("*****" + imageUrl);

            Uri screenshotUri = Uri.parse(imageurl);
            Intent sendIntent = new Intent(Intent.ACTION_VIEW);
            sendIntent.putExtra("sms_body", imageUrl);
            sendIntent.putExtra(Intent.EXTRA_STREAM,screenshotUri);
            sendIntent.setType("Image/png");
            activity.startActivity(sendIntent);
        } catch (Exception e) {
            Toast.makeText(activity, "SMS faild, please try again later!", Toast.LENGTH_LONG).show();
            e.printStackTrace();
        }
    }
}
4

1 回答 1

0

应该:

Intent sendIntent = new Intent(Intent.ACTION_SEND); // action must be SEND not VIEW
sendIntent.putExtra("sms_body", "some text"); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
sendIntent.setType("image/png");  // seems like you need write with little letter here

因此,在您的代码中,您应该采取错误的操作,ACTION_SEND并且您的类型也错误。应该是"image/png"

并且您的图片网址必须正确。

于 2014-11-04T13:03:13.900 回答