Hi,
the timer variable should be a member of the class not a variable within 
the body. That way you can check and cancel... Something like this will be 
closer to what you need:

UITimer timer;

protected boolean filter(String text) {
    if (text.length() == 0) {
        if(timer != null) timer.cancel();
        return false;
    }

    // other logic that doesn't involve server...
    if(timer != null) timer.cancel();
    timer = new UITimer(() -> {
       all your server fetch code should be here!
    };
    

    timer.schedule(1000, true, fmArticulo);
}


-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/c15a19b4-6960-4316-b901-861d5331b54c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to