How to detect when ListView recycles an ImageView?

I have a ListView with items ~ 600 in a 4-wide grid. Each element is a WebImageView (inherits from ImageView, slightly modified from code kindly provided here) over a label.

Everything works spot - we (and performance is awesome) except for one glaring problem: when I sometimes momentarily the ImageView ListView displays scrolling scrolls the erroneous image of an item that was previously on. Sometimes it moves even between two prior images before displaying the right pair. These problems are happening because applications for network WebImageView queues upward because the visible element has been recycled once or even twice.

What I need to solve this problem is to know when the WebImageView has been recycled by ListView in order to disconnect the network signals and erase the old image. I can't find how to do this.

So I have a "fix" that is more than a workaround. In the WebImageView, I added a member variable:

int m_iCurrentRequestIndex;

Whenever WebImageView has applied for a network, I add m_iCurrentRequestIndex as an attribute of the QNetworkRequest and then increment.

When I receive the response from the network, I check if the value of attraibute for example a_reply-> request (.attribute (...)) and throw the answer if it is not the last.

Not a very good solution because it is always that which allows network support needless to proceed and just throw the results, but at least it works. But if anyone can answer the question in the original post, I who brand as the solution because it will allow for better efficiency. I want to know a signal or something available at WebImageView that is called when ListView is recycled as:

WebImageView::onRecycled()
{
    // close() and disconnect() current QNetworkRequest().
}

Tags: BlackBerry Developers

Similar Questions

  • How to detect when a screen is navigated away from

    How can I detect when a screen is navigated away from?

    I can override onClose to run code when the user clicks the back button, is there a similar method that is executed when a screen is navigated away from independently to his by the user or the application itself?

    Since the control screen while application of the changes, you should be able to do it for most of the changes in your code.  I'm not aware of a tote place that you can do.  onObscured is called to the things that don't take you away from the screen.

    The only exception is if your username use switch application.  In this case turn off in the Application is called, perhaps this treatment can inform the active screen that something has changed.

  • How to detect when the user clicked 2 video clips?

    Hello:

    I would like to know how can I detect when 2 video clips were clicked (order irregardles).

    What I have is this:

    In my main script, I have 2 independent clips (mc_him and mc_her) each in its own layer which, when clicked, playing an internal animation without moving my head of main reading anywhere. What I do is, once both a click (like I said, it doesen't matter in what order), a button that sends me into another section of my film should appear. He really doesen't matter if the button activated with alpha or sending me to a specific framework where all my button. What I detect is two clicks for the button.

    How can I achieve this?

    Thank you very much.

    {btn1.onRelease = Function ()}

    No matter what

    This.Clicked = true;

    checkBothClickedF();

    }

    {btn2.onRelease = Function ()}

    No matter what

    This.Clicked = true;

    checkBothClickedF();

    }

    function checkBothClickedF (): Void {}

    {if (btn1. Clicked & btn2. Clicked)}

    do something. the two clicked

    reset the two clicked on properties?

    }

    }

  • (OSControl Xtra) How to detect when a user clicks on the bottom and upward when

    Hi all

    How can I detect when I click on a scroll bar downwards and upwards? I want something like:

    If sprite (1) ravishing (#down) then

    -do something

    on the other

    If sprite (1) ravishing (#up) then

    -do something else


    Any ideas? The question applies only to the OS control xtra

    I do not understand why you put the sprite.value and maxValue for
    a global event #prepareFrame - can you explain to us why, and 'who' it is
    who is responsible for these values?
    I tried to "simplify" your script, but I don't have a clear picture
    what your problem is - can you maybe post a simple example
    somewhere that clearly demonstrates?
    --
    pSprite property
    pScrollAmt property
    Global tMaxVal, maxbarvalue

    on beginSprite (me)
    pSprite = sprite (me.spriteNum)
    end beginSprite

    on prepareframe
    pSprite.maxValue = maxbarvalue
    pSprite.value = tMaxVal - position of the thumb
    end

    Update (me, aClickedPart)

    CASES (aClickedPart)
    #up:
    pScrollAmt = - 5

    #down:
    pScrollAmt = 5

    #thumb:
    If pSprite.value< tmaxval="" then="" pscrollamt="">
    otherwise if pSprite.value > tMaxVal then pScrollAmt = 10
    else exit
    CASES OF TERMINATION

    -It is important to 'catch up' the return value when you create a
    -timeout object, even if it is in a local variable that will be
    -immediately go out of scope
    t = timeout("scrollImage"&me.spriteNum).new (10, #sendScrollMessage, me)
    end

  • How to detect when a page is in sight with jQuery or javaScript?

    Is it possible a detect when a page is in sight? Currently, it seems that my document ready function is called when the page is the next or previous page and the current page. This is called two times... there at - it a reliable way to detect this?

    I came across this a lot. first thing is that when you look at a particular page, DPS is cached the pages around it, all around him, so it brings cached the top, right, bottom and left pages, which will throw things and play videos and what not.

    Here is the workaround to get it to only when launch in sight. set the time of reading automatic (I guess that's an overlay "webcontent") seconds a.125. It will start the clock only when the page (diamonds) is in sight.

    I don't know if theres an easier way, but it's like I do and it works.

  • How to detect when the selected item ObjectListField changed?

    I expanded the ObjectListField to implement a scroller of marquee style iPod for long lines of text that will disappear from the screen. So far, I have everything works well, and it works as I expect... when it fires.

    I'm having a problem to find a way to make reliable activate. It doesn't seem to be any method I can substitute or any earpiece I can use that fires when the current list item is changed. I first tried setSelectedIndex substitution. That worked sometimes, because apparently the OS is not call setSelectedIndex when he wants to change the item selected, it does something else.

    Then I tried the substitution of navigationMovement and manually call the code to start the timer, but that no longer works (I was the substitution of method navigationMovement of the ListField, maybe I should have done the Manager instead?). But anyway this approach does work for the version of the storm of my application because the storm never calls navigationMovement.

    Then I tried to use a fieldChangeListener, but apparently who don't get fired for the selection.

    Finally in despiration I tried substitution of drawListRow, only qualifying when index equals the selectedRow. But my code of scroll calls invalidate, so of course it just causes a loop infinite drawListRow, slow down the device and not even starting the scroll, because whenever the timer is started, it cancels the old one.

    Anyone have any ideas on what I can do here? Thank you.

    Good end I could not fieldChangeNotify to the fire, no matter which I overrided, even with the first setting the listener. It only seems fair to shoot during the selection change event. One thing to note, I use an objectlistfield, not an ObjectChoiceField... maybe you are thinking as well to another area?

    Thanks for the help anyway, in the end I was able to get the desired effect by modifying the code slightly to reuse the same animation timer rather than create a new one when the selected item changes. The timer is started in the constructor of the ListField. Works very well.

  • How do I detect when a write of correlated digital output is completed

    Hi LabGurus

    I'm trying to synthesize a SPI signal on the output lines digital stamped usin a M - Series USB Daq (6225, 6229).

    I wrote most of the code and have developed the following problems:

    When I use 'finished samples' to the clock mode, the waveform it is limited to the size of the buffer on board. There is no specific error, but the output waveform is strangely truncated States 1027. The nidaq buffer is fixed and changing the buffer on Board has no effect.

    When I use continuous samples, there is no way to detect when the task is finished 'Really' (I can clarify in the last round of data is transferred to the device, but not when he was timed out of the unit).

    "Task Daqmx is over" and "Daqmx Wait for completion" give no idea.

    I detect when the last USB device transfer is completed using a write property node Dqmx and comparing 'written total samples' at the 'current write Position.

    The function works as much as I leave long enough so that the task is completed. In almost a fixed delay is not acceptable.

    Timmar,

    For the finite method, have you tried to change the value of "samples per channel" on the VI of Timing DAQmx?  It's what you define for your task to know how many points to wait at the exit.  The default value is 1000.  I hope this helps.

    Kind regards

    Brian T

    Technical sales engineer

  • How can I detect when the last container in my stream is full?

    I have a bunch of related containers which I am flowing text through. How can I detect when the text has filled a container? There's an overflowPolicy then I guess it can be detected.

    Hello

    I used this:

    private function IsOverset(textFlow:TextFlow):Boolean

    {

    var zeComposer:IFlowComposer = textFlow.flowComposer;

    var iTextLen:int = textFlow.textLength;

    var iNoController:int = zeComposer.findControllerIndexAtPosition (iTextLen - 1);

    return (iNoController is-1);

    }

    HTH,

    J.

  • How to recharge a ListView when an item is deleted or changed?

    So I have a ListView in a Page that lists the files.  And the selected files are sometimes renamed or deleted on the triggering of action items, how to refresh the ListView to reflect these changes?

    I would refresh my data model during the outbreak of the follow-up action. It would be just a matter of ListView redisplay with the new data model data.

    It is not in a Navigation pane so I can't push a ComponentDefinition.

    Hello

    Have you tried clearing the datamodel and re - insert the data into it.

    Clear() - http://developer.blackberry.com/cascades/reference/bb__cascades__groupdatamodel.html#function-clear

    insertList() - http://developer.blackberry.com/cascades/reference/bb__cascades__groupdatamodel.html#function-insert...

  • GPIB has not detected when connected to the internet

    Hello

    I have keysight power supply connected to the PXI-8880 via GPIB, it does not detect when it is connected to the internet & it was detected when its not connected. Any body can help me to solve this problem.

    Hello

    This problem occurs because of a conflict in present multiple network adapters in the system. It was a question that has used for detection of targets ethernet to the system that has been resolved. But then this question has also resolved to do the same thing. You can follow the link on how to change the order of the present network adapters in the system.

    http://digital.NI.com/public.nsf/allkb/FD9E1AF5AB1343098625736F0076DE6B

    You must also make sure that the IP addresses of the network adapters are different, otherwise conflict can happen also.

  • How to detect the channel delete event in a custom device

    I am creating a custom device and want to detect when you press the button Delete (X) in the system browser.  This is so I can increment or decrement a counter in a folder (where the channel is under).  I saw no option in UserEvent loop options.  How do I detect that a channel is deleted?, I'm sure it's easy, but I can't seem to understand.

    Thank you!

    I recommend usually do not do that... If you can avoid it. For example the parent folder can do if everything is just a child get point-> the size of the array to count channels rather than storing a property that could get out of sync. I always try to design my devices do not store the property values for things I could go get.

    That being said... Sometimes you don't have that. You want an actionviondelete: https://decibel.ni.com/content/docs/DOC-30447

  • How to detect the change of focus between applications

    LV2013, Win7

    I have a long operation that so I have to.  Let's call it a "scan".

    I start to a particular folder on the disc and look for files within this framework and in those folders, etc.  I am looking for a particular file (*.lvlibp).  When I find one, I need to open it, look for particular screw it contains and check them for executability (broken) and fix the ConnPane, etc.  I put all the elements of qualifications in a menu (in the menu bar) as the submenus and submenus, etc..

    I do the scan in a separate thread, is not as if I'm blocking anything either, but it takes away CPU time that I would rather not use.

    If I do the scan only once, then the user can go to the Explorer, move a file in place, or rename a folder and come back and I miss the changes.

    Right now, I do whenever the single window happens (the one to which applies the menu).  But this means that round in my application of switching windows causes the scanner again, when there is no chance of a new file that appears.

    I would like to do this scan only when it is necessary, that I define as when I come back from another program (WIndows Explorer for example) this single window in my LabVIEW application.    I am ready to accept the fact that Scripts Windows or remote operations may sneak a file in there.  I don't mean to be bulletproof, just accommodating the more common scenarios.

    I don't want to make a kind of vote - the entire application is event-driven, and I want to keep it like that.

    So, how can I do this?

    If I look at the ACTIVATION VI event, it looks like it happens for ALL VI have activated.  I can attach a name-comparison and detect when the right window is coming forward, but again, simply because this window comes forward does not mean that I need to analyze.

    If I look at the event of ACTIVATION of the APP, it seems to be NEVER called. Even in an EXE file, the event seems never to occur.

    If I had an event to DISABLE the APP, I could set a flag when it happened, and the next time that the right window comes up, I could check the indicator and scan if necessary.

    But I did none of this case.

    Any ideas on how to do this?

    I think what I'll do is just watch the LAST MOD TIME of the parent folder.

    When I do a scan, I hide the LMT of the parent.

    Then, whenever the WINDOW is enabled, I'll check the LMT to the case against my hiding place.

    If it is different, then I scan again.

    Check the LMT takes about 50 uSec on my system, a relatively small price to pay.  And I do it when the window comes up to the top, so I will not notice every little detail of what you do, and I don't have to dig into .NET and assemblies and versions and unnecessary and other error messages.

  • How to detect a Variant empty?

    I get an error when my application passes a variant vacuum (as determined by the probe) to a variant of the function Data. The variant is a Global Variable that has not yet been initialized. I need to avoid calling the variant of the function of data as long as the variant is empty.

    How to detect that a variant is empty? I can't find a function or constant that will help me to do this.

    LabView 2010 is pretty inconsistent about how empty variables of different types are detected. How is there aren't any detection methods of vacuum for each type of data? Why are not always done in the same way?

    You can right click on one of the connectors on a service of alternative variants and select create constant.  This will create a small empty box of purple.  Then you can compare your Variant that and if it is empty, the comparison will be true.

  • How to detect slide them down from the top bar in a Flex application

    How can I detect when there is one down from the top bar?

    I found this page, but it only detects gestures on the application not the Playbook side bar gestures.

    http://docs.BlackBerry.com/en/developers/deliverables/37033/Responding_to_events_1425036_11.jsp#code...

    Creating an application menu BlackBerry PlayBook Tablet using the BlackBerry Tablet OS SDK from Adobe...

  • detect when it is called card has been closed

    I'm looking for a signal that will help me identify when a card called was closed (down rear position)...

    for example, I called the card sys.mediaplayer.previewer and want to detect when this map is closed when the user is back on his previous screen...

    I mentioned 'closed' especially instead of back as if you use the mediaplayer card, it will automatically shut down/back himself once made video play.

    onTopChanged did not

    Anyone know how to whom?

    connect(invokeManager, SIGNAL(childCardDone(const bb::system::CardDoneMessage&)), this, SLOT(onCardDone(const bb::system::CardDoneMessage&)));
    

Maybe you are looking for

  • Philips dyed white Starter Kit found that it cracked so I want to just return item

    Philips dyed white Starter Kit A19 E26 who ordered 2 days ago and happened I found that it was cracked so I want to just go back to the item, but is not able to return (it is not printed about to return) This point is not on my shopping list wasn't e

  • An appropriate case or cover to Yoga 2 8 Tablet?

    Nobody here don't know or use a good case/cover for their Yoga 2 8 "tablet and if so, where did get it? I have some on eBay and Amazon have looked but can not make my choice. All answers gratefully received.

  • Acer-TC-120 and the improvement of the possibilities?

    I'll buy this pc, Acer TC-120 DTSVKEQ009 for my 12 year old son. I am looking for information on the possibilities of upgrading this computer in the future, but can't find much information on this subject. I find the places that says it can have maxi

  • The Documents folder saying refusal to shared access.

    I am administrator on my XP Home Edition.  I can't get in the shared documents folder more.  By clicking on it, trying to access it from a command prompt to give me the access denied error message. How can I fix this?

  • Original photo Screensaver

    Is it possible to have the origin of the file printed on the image when shown as a screen saver.  My XP will do, but I can't find any setting on Vista.