I am trying to download a file from Box API application using their download function as stated here .
...
FileOutputStream stream = new FileOutputStream(info.getName());
// Provide a ProgressListener to monitor the progress of the download.
file.download(stream, new ProgressListener() {
public void onProgressChanged(long numBytes, long totalBytes) {
double percentComplete = numBytes / totalBytes;
}
});
....
However I am unable to use the onProgessChanged function. Is there any examples as to how to access it? How do I access it?
This is just a workaround. Create a class
ProgressOutputStreamby extending super classOutputStream.Call
ProgressOutputStreamin yourfile.download()like:Give it a try. Hope this will give an idea.