Giter Site home page Giter Site logo

Comments (5)

tonyofrancis avatar tonyofrancis commented on May 15, 2024

Ill have a look at the sample and will post back here

from fetch.

tonyofrancis avatar tonyofrancis commented on May 15, 2024

@altaf2892 Have not been able to have a look at your code. Can you replicate the issue and post the logs here? Do the downloadId match the request id you want to pause?

from fetch.

altaf2892 avatar altaf2892 commented on May 15, 2024

see below implementation to pause running download onclkick

`if (fetch != null) {
List requestInfo = fetch.get();
for (int i = 0; i < requestInfo.size(); i++) {
if (requestInfo.get(i).getId() == model.getId()) {
Log.e("match", requestInfo.get(i).getId() + " " + model.getId());
try {
fetch.pause(model.getId());

                        } catch (Exception e) {
                            Toast.makeText(holder.itemView.getContext(), e.toString(), Toast.LENGTH_SHORT).show();
                        }
                    }
                }
            } else {
                Toast.makeText(holder.itemView.getContext(), "error occurred", Toast.LENGTH_SHORT).show();
            }
        }`

i get printed log with same match id but downloading not getting pause

from fetch.

tonyofrancis avatar tonyofrancis commented on May 15, 2024

@altaf2892 you do not have to get all the requests from fetch in order to match the one you are looking for. Simply call fetch.get(downloadId) and it will return the request if it exists. Attach a FetchListener to fetch before performing any operations in order to get status updates of a request. Have a look at the sample code in this project.

from fetch.

tonyofrancis avatar tonyofrancis commented on May 15, 2024

@altaf2892 Are you sure you are pausing the right request with the right id? Please compare the id when you have enqueued the request with the model id when you are clicking the pause button. I do have a feeling they do not match. Does your catch method every get executed?

from fetch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.