NetworkManager for use with ProgressListener

32 views
Skip to first unread message

hardc...@gmail.com

unread,
Nov 18, 2015, 10:01:51 AM11/18/15
to CodenameOne Discussions
using NetworkManager I have a single function being called to handle all of the ConnectionRequests how can I single out one of the connections to add a ProgressListener to and additionally how would I then close that listener.

I am attempting to add ProgressListener so that I can get the SliderBridge popup to display while retrieving json from the server. But there is neither a tutorial or alot of demo code on how to do this.

Yahya-Imam Munir

unread,
Nov 18, 2015, 3:36:03 PM11/18/15
to CodenameOne Discussions, hardc...@gmail.com
Hi, if i get your question right I think all you need is this: https://www.youtube.com/watch?v=aieiLAB_wCQ
Change the dialog to any control of your choice.

Shai Almog

unread,
Nov 18, 2015, 10:38:04 PM11/18/15
to CodenameOne Discussions, hardc...@gmail.com
We focused more on the infinite progress which was simpler.
You can invoke removeProgressListener() when the connection request completes.

Notice that SliderBridge is supposed to remove itself.

I've made a note to blog about SliderBridge and maybe improve it, its on the bottom of a bit of a huge list of "todo's" I have on my plate but I'll try to get to it eventually.

cblanken...@gmail.com

unread,
Nov 19, 2015, 11:06:09 AM11/19/15
to CodenameOne Discussions, hardc...@gmail.com
Shai:

can i specifically target 1 call out of many going thru my function that handles the connectionrequests to add a listener to. because it appears that the connection is being held open and therefore not closing out or can you please provide some very simple example code.

Example of how this is currently working Setup function is calling getResponse which creates a connectionrequest sends information to sendRequest which does the connection and the NetworkManager.getInstance().addToQueueandWait is located.

Thank you.

Shai Almog

unread,
Nov 20, 2015, 12:07:17 AM11/20/15
to CodenameOne Discussions, hardc...@gmail.com, cblanken...@gmail.com
Haven't used it in ages but isn't it just:
SliderBridge.bindProgress(slider, connectionRequest);


Reply all
Reply to author
Forward
0 new messages