我正在使用 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();
}
如何在 facebook 和 whatsapp 中分享获取的屏幕截图?
最佳答案
获取屏幕截图的路径并像下面这样发送
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/