Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

蕾雷's avatar
蕾雷
Helpful | Level 6
8 years ago

How do I cancel the process that is being downloaded?

When I use DbxDownloader <FileMetadata> .download to download, halfway to cancel the download call DbxDownloader <FileMetadata> .close to operate, but I got a NullPointerException exception, Message is "Attempt to read from filed" int com.android.okio. Segment.limit 'on a null object reference ", but I have done a non-empty argument on the parameters.

And I later use the DbxClientV2 object, such as get the file information: DbxClientV2.files (). GetMetadata (), will get ArrayIndexOutOfBoundsException exception.

3 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:

    - the version number of the SDK you're using
    - the exact steps to reproduce the issue, including the code snippet(s)
    - the full text of the error/stack/any output

    Thanks in advance!
  • 蕾雷's avatar
    蕾雷
    Helpful | Level 6
    8 years ago

    Thank you!

     

    (1) Dropbox core API: 3.0.2

    (2) Download the code reference: https://github.com/dropbox/dropbox-sdk-java/issues/66.

     

      Download interface click back to cancel, call stopDownload function:

     

          DbxDownloader<FileMetadata>  :  downloaer
          public void stopDownload() {
    if (downloaer != null) {
    try {
    downloaer.close();
    downloaer = null;
    } catch (Exception e){
    downloaer = null;
    e.printStackTrace();
    }
    }
    } 

     

    (3) stopDownload throws an exception:

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    Thanks! We'll look into it.

    For our reference though, can you also share how you're constructing your client object?

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!