gpt4 book ai didi

android - 从图库到图像的图像以字节为单位..还有以字节为单位的数据..用于在android中上传facebook

转载 作者:太空狗 更新时间:2023-10-29 14:27:55 26 4
gpt4 key购买 nike

我得到了将图片和视频上传到 Face Book 的代码。但我不知道如何将图像从画廊转换为字节图像..还有字节数据..任何人都可以帮助我吗????

*Upload picture,
Bundle params = new Bundle();
params.putByteArray("picture", <image in bytes>);
params.putString("message", "Have fun");
mAsyncRunner.request("me/photos", params, "POST", new SampleUploadListener());*

this is code for upload images...
*Upload video,
Bundle params = new Bundle();
param.putString("filename", <dataName>);
param.putByteArray("video", <data in bytes>);
mAsyncRunner.request("me/videos", param, "POST", new SampleUploadListener());**

this is code for upload images...
Any one know how code for my question please post.....

提前致谢

最佳答案

Get file path from here

试一试-

FileInputStream is = new FileInputStream(new File(filePath));
ByteArrayOutputStream bs = new ByteArrayOutputStream();
int data;

while((data != is.read()) != -1)
bs.write(data);

is.close();
byte[] raw = bs.toByteArray();
bs.close();

关于android - 从图库到图像的图像以字节为单位..还有以字节为单位的数据..用于在android中上传facebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10139532/

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