1

我正在尝试从 SD 卡在 Twitter 上发布一张图片。还尝试从图像 URL 发推文,但图像未显示在作曲家上。

下面是我的代码:

    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bytes);
    File destination = new File(Environment.getExternalStorageDirectory(),
            System.currentTimeMillis() + ".jpg");
    FileOutputStream fo;
    try {
        destination.createNewFile();
        fo = new FileOutputStream(destination);
        fo.write(bytes.toByteArray());
        fo.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    String path = destination.getPath();
    Uri bmpUri = Uri.parse("file://" + destination.getAbsolutePath());
    //Uri bmpUri = Uri.parse(path);


    String body = "…Check it out for yourself !";
    TweetComposer.Builder builder = new TweetComposer.Builder(this)
            .text(body)
            .image(bmpUri);

    builder.show();

我已经浏览了可用的解决方案,但没有一个有帮助。请帮助我知道为什么图片没有发推文。

任何帮助将不胜感激。在此先感谢。

4

0 回答 0