Android Facebook SDK Progress Bar during upload

2019-02-25 17:51发布

I am trying out the FB SDK and I was wondering if it is possible to attach a progress bar while data is being uploaded.

This is a sample example on how FB tells us to do.

ByteArrayOutputStream bos = new ByteArrayOutputStream();
me.compress(Bitmap.CompressFormat.JPEG, 100, bos);
params.putByteArray("picture", bos.toByteArray());
mAsyncRunner.request("me/photos", params, "POST", new SampleUploadListener(), null);

The issue is that you are forced to use a byte array instead of an output stream which you could combine with a progress bar

One alternative I can imagine is to modify Utils.java from the FB SDK but I would rather like to ask if someone had success implementing a progress bar without massing around in the facebook sdk?

1条回答
够拽才男人
2楼-- · 2019-02-25 18:15

I found a solution but it involved touching the facebook sdk.

Here is the modified code in Util.java.

查看更多
登录 后发表回答