gpt4 book ai didi

java - 如何在 whatsapp 和 facebook 分享 libgdx 游戏得分的截图?

转载 作者:行者123 更新时间:2023-11-29 11:54:40 25 4
gpt4 key购买 nike

我正在使用 libgdx 为 android 和 ios 开发游戏。我已经使用此功能获得了屏幕截图,

public void take() {
byte[] pixels = ScreenUtils.getFrameBufferPixels(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);

Pixmap pixmap = new Pixmap(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), Pixmap.Format.RGBA8888);
BufferUtils.copy(pixels, 0, pixmap.getPixels(), pixels.length);
PixmapIO.writePNG(Gdx.files.external("mypixmap.png"), pixmap);
pixmap.dispose();
}

如何在 facebookwhatsapp 中分享获取的屏幕截图?

最佳答案

获取屏幕截图的路径并像下面这样发送

Intent share = new Intent(Intent.ACTION_SEND);
share.putExtra(Intent.EXTRA_STREAM, uri);
share.setType("image/*");
share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(Intent.createChooser(share, "Share image File"));

注意:Whatsapp 不会同时接收图像和文本。

关于java - 如何在 whatsapp 和 facebook 分享 libgdx 游戏得分的截图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39653967/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com