Fields from painting hidden on the screen

Hello

I have a screen that adds custom himself fields. Custom fields contain information downloaded before the loading screen and an image that is downloaded from a PHP script, when the field is painted. Currently, what happens is that when you scroll down, and a new field is revealed, it runs the paint method, which downloads the image and stores it in memory.

What I want to do, is have a default image for all objects, and have two sons: one that downloads photos while the user is using this screen, and another thread that redraws the fields if their images were downloaded. This is the code that sets up the screen:

public void CreateIncidentList(ResponseGroup rg) {   for (int i = 0; i < rg.getIncidentsUBound(); i++) {        IncidentListItem ili;     try {         ili = new IncidentListItem(rg.getIncident(i));            add(ili);         //ili.invalidateLaneBitmap(); //XXX: Do we need to do this to force it to paint blank lanes the first time?         } catch (Exception e) {            continue;        }        if (i < (rg.getIncidentsUBound() - 1)){            add(new SeparatorField());            }    }

  threadLaneBitmapDownloader = new Thread(LaneDownloader);  threadLaneBitmapRepainter = new Thread(LaneRepainter);    threadLaneBitmapDownloader.start();   threadLaneBitmapRepainter.start();    try {     threadLaneBitmapDownloader.join();    } catch (InterruptedException e) {        e.printStackTrace();  } try {     threadLaneBitmapRepainter.join(); } catch (InterruptedException e) {        e.printStackTrace();  }}

Here is the Downloader executable:

private Runnable LaneDownloader = new Runnable(){

public void run() {
    //Manager m = me.getMainManager();
    int numIncidentListItems = getFieldCount();
    IncidentListItem ili;
    Incident i;

    for(int x = 0; x < numIncidentListItems; x++){
        try{
            ili = (IncidentListItem) getField(x);
            i = ili.getIncident();
            for(int counter = 0; counter < i.getUBoundLocalIncidentInformation(); counter++){
                if(i.getLocalIncidentInformation(counter).getLaneBitmap() == LocalIncidentInformation.blankLane){
                    i.getLocalIncidentInformation(counter).downloadLaneBitmap();
                }
            }
        } catch (ClassCastException e){
            continue;
        }
    }
}

};

This is the executable Repainter:

private Runnable LaneRepainter = new Runnable(){

   public void run() {       while(threadLaneBitmapDownloader.isAlive()){          Manager m = me.getMainManager(); //Don't know if this is correct!         int numIncidentListItems = getFieldCount();           IncidentListItem ili;         Incident i;

          for(int x = 0; x < numIncidentListItems; x++){             try{                  ili = (IncidentListItem) getField(x);                 i = ili.getIncident();                    if(ili.getPaintedLaneBitmap() == LocalIncidentInformation.blankLane){                     final IncidentListItem mIli = ili;                        UiApplication.getUiApplication().invokeAndWait(new Runnable(){                                public void run () {                                  mIli.invalidateLaneBitmap();                                  mIli.setPaintedLaneBitmap(mIli.getIncident().getLocalIncidentInformation(0).getLaneBitmap());                             }                         });                   }                 try {                    Thread.sleep(100);                 }                 catch (InterruptedException ioe) {                        System.out.println(ioe.getMessage());                 }

               } catch (ClassCastException e){                   continue;             }         }     } }

};

What I want to accomplish is to allow the user to scroll the fields while the images are uploaded and refreshing while scrolling. IncidentListItems are wrappers for field for objects of Incident which is where the image is stored. There is also a field called paintedLaneBitmap, which is supposed to store the picture that was painted when the IncidentListObject is created. This should normally be the image of blankLane. The idea is so that only one thread download background images and another thread checks to see if laneBitmap of the object of the IncidentListItem Incident is different from being painted and repainted the field.

How can I accomplish this?

Thank you very much in advance.

Sorry I did not yet look your code because I would actually do what you want a different way.

Here's a quick suggestion.

Have a Thread dealing with your downloads.  He works outside a queue, you add the pictures you want to download in the queue.

The queue is just a vector of objects.  Each object contains enough information for the Downloader to get and keep the useful image somewhere.  There also a "passable".  The executable is responsible for the update of the screen.

If your thin wire of downloading an image, it's simply an invokeLater on the floor, which then becomes responsible for the update of the screen.

So there is no vote, no loop, you use notify/waiting on the download Thread so it uses all resources except if we work to make it.

There are many many variations on this theme, but I hope it's enough to make you rethink how you treatment works, that he will do what you want more efficiently.

Tags: BlackBerry Developers

Similar Questions

  • Web pages display lingers when hidden - not hidden until the screen interacted with

    Just had the time to find the solution to this problem, that I experienced. Impossible to find a solution from the forums search.

    I used a QNXStageWebView and I wanted to hide when the user switches to another view of the application. I tried to set the scene on a null value, the zOrder-1 and the visible to false. None worked without a problem, as the webView wouldn't be hidden until the user attempted to interact with the latter, when the UI would suddenly be cool and hide the persistent webView.

    See below for the solution.

    The solution: set the viewport to null, in addition to affecting the zOrder-1, when you want to hide the QNXStageWebView.

    webView:QNXStageWebView = new QNXStageWebView();

    webView.viewPort = null;

    webView.zOrder = -1;

  • CP8: Exit how to user input from a TextBox on the screen?

    How I got out to the screen a value entered by a user in a TextBox? So if they type in "Hello World" - how to display "Hello World" to the screen? And I can view the form the text of a button or smartshape so?

    Each text box entry has an associated variable, its generic name is the same as the TEB (I prefer to change to a better name). You can insert this variable into a container of text (legend or form) as any other variable using the X key in the role of composition (I can't post a screenshot, ignore the version you use, could be anything from 6).

    You cannot use a variable as a label on a button. You can insert a variable into the text in a form that behaves like a text container. This is another big advantage of a form a normal button button: you can make the dynamic label using a variable as the label.

  • How can I prevent my addon buttons from being hidden by the drop down "more tools" menu?

    I have several addon buttons on my toolbar to the right of the obtained. Firefox hides in a menu button drop down titled "more tools... ». I don't want to do that, but I can't figure out how to change this behavior. When I enter the Customization screen, the button disappears, and neither she nor any of the buttons it hides appear on a toolbar or in the component "other tools and features.

    Sometimes when I first open Firefox, my addons will show the way I want to do, but then some time in the Firefox session randomly will collapse them in the new drop-down list. How can I stop the Firefox hide something in this drop-down list?

    I'm talking about here is a screenshot of the drop-down list: https://i.imgur.com/DVpxxe4.png

    Normally, when you adjust the width of the window of the browser, the search box and got will be 'flex' becoming more or less long to accommodate the change. However, they have a minimum width, and if the window becomes narrower than, the "overflow" menu/button will appear.

    The problem may occur with a wider window on the sites with certificates EVSSL, like this one, where the owner of the site name appears next to the Green padlock. That takes a lot of space...

    You can probably can change the behavior of Firefox with a custom style rule, but 'something' must be sacrificed to make room...

  • How to retrieve info from my i5c if the screen does not work and the warranty has expired?

    My iphone 5 c screen does not work and my warranty has expired there is 138days. I visited my carrier (AT & T) and contacted the Apple support.

    I want just the information of contact at least if nothing else my phone. What can I do?

    Have you tried to backup with iTunes on your computer?

    Are you also the timing or the iCloud backup device?

  • Immediate paint on the screen!

    Hello

    I am writing an application show free hand in writing. I have the observer, if we draw the lines using the graphical display manager, these lines does not appear immediately, all my drawings appears only after once the screen refreshes on event like pressing button or switch the screen backlight option.

    If I call invalidate after each line draw erase all lines, lines never appears. If I just called doPaint(), he is unable to do the painting. If I press the menu of options, he painted the entire screen as he painted menuitems on the screen.

    Any body has the same problem.

    Thank you

    Marie-Paule

    I would try to call Screen.updateDisplay)

    This empty current graphic content for the display device.

  • How to fill the screen with custom display fields

    I need to instantiate a class of custom field and add it to a number fixed times who knows @ length of the screen.

    I created a table to create objects of a custom field, and then I add elements to the screen one by one.

    I use this code where the entries knows @ runtime.

    There is error but the fields are not added to the screen and the screen and the screen is blank.

    CustomField item[]=new CustomField[entries];
    int entries;
    for(int i=0;i			 

    Some stupid problem just to retrieve the integer. Now, copy the following code works correctly.

  • When I stop I get message from windows, but cannot read it leaves the screen

    When I shutdown stops, she arrives with a message from windows, but leaves the screen before you can read it

    There is a place to CANCEL but you can't do anything, so he continues to stop.

    Hello Joan.

    Have you tried the key break on your keyboard? Try and see if it helps you.

    Kind regards

    BearPup

  • Tablet draws a leak out of the screen directly to the left, whenever I have down Flash CC

    My TS-6608 Turcom / Oh P608N Tablet (people say that they are the same model and I tried both the original driver P608N installation and driver installation Turcom TS-6608 slightly modified for Windows 10 Turcomdrivers)

    draws a line from leaking out of the screen directly to the left whenever I have support with my pen pressure instead of my way of drawing. In Adobe Photoshop CC, it works perfectly fine. Why is this happening and how can I solve this problem?

    A line for every time I press. It is the only blue because that's the color of pen, I had chosen. This happens with the pencil tool and the Brush tool. I happen to run two monitors. Flash is open on the right monitor but I tried to swap around, drop down to a monitor, and it doesn't seem to change. I don't know if this is specific to my tablet or a problem with the program.

    LeftLineInFlash-HuionP608NTablet.png

    It seems that there is a split second after the contact where it does not read my travels before putting in the left straight down.

    2015-08-26 20_38_56-Untitled-2 (Canvas)_.png

    2015-08-26 20_43_05-New notification.png

    In Flash CS6, there seems to be a similar problem. When I press down, the first point shows but it stops to record the pressure down almost instantly even if I continue upward with the pen pressure. He holds the State pressed down but is not to follow the movement. With my mouse, I can then move around to draw the path, but it is not picking up the pen.

    2015-08-26 21_11_19-Untitled-1_.png

    Post edited by: Christopher Navarre

    Post edited by: Christopher Navarre 11:14 August 26, 2015

    In Flash CS3, it goes the same way as Flash CS5.5 where appears a point, it will not save the press which took place or release of the pen tip. If I move the mouse after pressing the pen, I can drag it around the same way. The problem seems to be that flash is not just reading presses pen continues but I don't know how to fix it. In other programs, it seems to work very well (Paint, Photoshop, etc.)

    Another thing I discovered is that if I have another program that is not selected in the active window flash but try to draw in flash using the Brush tool and then he reacts appropriately, but the second I drop the brush stroke and let Flash CC 2015 be the active window again it does not recognize my movements.

    I think it might be a simple driver issue.

    ANSWER:

    There seems to be a bug in the driver Turcom code. If you disconnect a monitor then you can normally draw in flash. What happens with two monitors, it's that the pen cursor position instantly repositioned correctly when you press down. Because I was drawing on my right monitor, it tended to be left (maybe because thought Flash that I worked on monitor 1 or something).

    I have an e-ticket with Turcom as a permanent solution, but for now, simply using a monitor works fine.

  • Why don't my PrintOut look like the screen display?

    This happens everytime I use Firefox.

    Whenever I try to print a list of Ebay, the main image is omitted from the print. Here is an example. This first link is to a (Fn and PrtSc) screenshot of a typical list on Ebay:

    http://s1176.Photobucket.com/albums/x327/xvqgp/Firefox

    Search for image FirefoxScreen.jpg PhotoBucket page

    There is an overview of the issue at the left side of the page.

    Now take a look at what I get when I use the command 'Print' to Firefox (it is a scan of the printed page):

    On the same page look PhotoBucket for FirefoxPrint.jpg

    There is a big empty space where the main image should be!

    I have not been idle and checked a few things before I ask this question:

    (1) I went to print as settings the useful Firefox article on printer troubleshoting points out. It has not cured the problem.

    (2) of the same article, I have tried the function 'Print' on Internet Explorer. Although it pains me to say, I have the correct impression of Internet Explorer.

    (3) to use Firefox in "Safe Mode" has not removed the problem.

    (4) operating in 'Normal' mode but with disabled modules did not remove the problem.

    (5) when I move the mouse over the main image on the Ebay page I

    JavaScript:;

    in the lower left corner of the screen. It is perhaps a clue, or is it a herring-saur?

    I would be very grateful for the help.

    Have you tried to use the print at the bottom if this eBay page?

    Or is that what you use?

    All in all, it is not unusual for "print" be a little different from what shows on the screen ' ", this page can use @media to"screen"and"print ". The print on this page could be the difference, or the web browser may be after that code is that you used the print button or the menu item in Firefox.

    http://www.w3.org/TR/CSS2/media.html#media-types

    As a general rule, the @print CSS is used to hide the menu navigation (can not 'navigate' to an another page on a sheet of paper) and maybe ads (can not 'click' on an advertisement which is made on paper) in being printed so that the article text is printed on paper.

    Basically, it is probably not a flaw with Firefox, but rather Firefox following the commands on the page placed there by the person who wrote this page, or a standard "CSS stylesheet" used by eBay.

  • Satellite U920t curtains blackout - lights blinking but the screen is completely released

    Hi everyone, I really would like to get help here.

    My relatively new Satellite U920T - 10G turns off without reason. I turned it on as Tablet and when I pulled the keyboard, he became all black. At first, when I've quand j' ai cache hidden keyboard the screen just work again but now it just does not in any case (even though I see its on!) IAM I must be missing something as happened within two months Ive been using it.

    Thank you in advance!

    ClaudiaR

    Hi Claudia

    I n t have this machine and cannot say what may be the problem. Try to roll back the OS to earlier time when he was working just to see if this will help. If this is not the case, try to reinstall the OS using recovery image installation and test with the factory settings.

  • Graphics, drawBitmap, setARGB... Why can't I just draw a bitmap on the screen?

    Help!

    I am new to Java, much more for blackberry. I try to have some data belong, but all I see is a white screen.

    JDE is 4.5.0

    // imports be here
    
    public class navandApp extends UiApplication {
        public static void main(String[] args) {
            navandApp app = new navandApp();
            app.enterEventDispatcher();
        }
    
        public navandApp() {
            pushScreen(new Shcreen());
        }
    }
    
    final class Shcreen extends FullScreen {
        public Shcreen() {
            // I create an Array and fill it with color values
            int[] bitArray = new int[36];
            int color1 = 0xFFFF00AA;
            int color2 = 0xFFBBCC00;
            int color3 = 0xFF12BBEE;
    
            for (int i = 0; i < bitArray.length; i += 3) {
                            // Bitmap will be just a set of 3 consecutive colors over and over
                bitArray[i] = color1;
                bitArray[i + 1] = color2;
                bitArray[i + 2] = color3;
            }
    
            // The idea is to use this Array to form a bitmap and display it on the screen
            // Bitmap's dimensions will be 6x6
            Bitmap image = new Bitmap(6, 6);
            image.setARGB(bitArray, 0, 6, 0, 0, 0, 0);
            Graphics stupidGFXDoesntWork = new Graphics(image);
            // Not sure if the following would be necessary or not...
            stupidGFXDoesntWork.drawBitmap(0, 0, 6, 6, image, 0, 0);
    
            // Nothing happens! Blank screen! >:(
        }
    }
    

    ... So what I am doing wrong?

    Well, what you have is exactly what I proposed. To override a method in Java, you must specify exactly the same formal parameters as the method of the superclass. In addition, you must move the declaration of the image by the manufacturer and make a class variable. Try this version of the Shcreen class (I have marked the changes that I think you should do your code):

    final class Shcreen extends FullScreen {    Bitmap image;    public Shcreen() {        int[] bitArray = new int[36];        int color1 = 0xFFFF00AA;        int color2 = 0xFFBBCC00;        int color3 = 0xFF12BBEE;
    
                for (int i = 0; i < bitArray.length; i += 3) {                bitArray[i] = color1;                bitArray[i + 1] = color2;                bitArray[i + 2] = color3;            }
    
            Bitmap image = new Bitmap(6, 6);        image.setARGB(bitArray, 0, 6, 0, 0, 6, 6);        Graphics GGG = new Graphics(image);        paint(GGG,image);    }    protected void paint(Graphics g, Bitmap I){        super.paint(g);        g.drawBitmap(0, 0, 6, 6,I image, 0, 0);    }}
    

    The key to understanding it is that the system automatically calls the method paint (Graphics) of the screen when it's time for the screen to display on the screen. You shouldn't try to get rid of it in the constructor.

  • Importing data from XML form in hidden form fields &amp; making it visible if the book value

    Hello:

    I export the data in the form submitted, and important in the 2nd-> 3-> etc... Forms, however, a lot of these areas, I want to be kept hidden, unless they have a value. When I import data from field of forms 1, it will be smooth, however if the fields are hidden, you must go through the selection of checkboxes to make it visible again or just do all visible all the time. I was wondering if there is a feature or coding that would go in the direction of: Once imported XML favorite on click on the button "Update fields", go through fields and if hidden fields now have a value do what subform/Sub-sous-form Visible.

    The reason is that if you do have an incident report form which can take 10 names of employees, but only 2 were involved in an incident, it would look very cluttering on the survey form, if there are 10 fields name employee, 10 fields, 10 fields of plane location, etc... But only 2 employees have been involved in a minor incident on the incident report form which does not imply anything else.

    Any suggestion or help would be greatly appreciated and thanks for gratefull to any answer.

    Nicely,

    Al

    Thank you for pointing me in the right direction... A little elbow grease, of coffee, patience, and did I mention the patience and the following works without fault

    Created at the mouse from the export button:

    xfa.host.exportData("",0)

    The button import of other form value:

    xfa.host.importData)

    See the sections "Check boxes" to see if this article is supposed to be visible and makes visible the value of import form form: Ready:

    if(Button_DelDep.RawValue == 1)

    {

    Del_Dep.presence = "visible";

    }

    if(Button_DelArr.RawValue == 1)

    {

    Del_Arr.presence = "visible";

    }

    if(Button_Div.RawValue == 1)

    {

    Div.Presence = "visible";

    }

    if(Button_MADiv.RawValue == 1)

    {

    MADiv.presence = "visible";

    }

    if(Button_DelDepXD.RawValue == 1)

    {

    Del_DepXD.presence = "visible";

    }

    if(Button_Other.RawValue == 1)

    {

    Other.Presence = "visible";

    }

  • Keep the bar from the top hidden in full screen, even when said on

    When you are in full screen view and you press the cursor of the mouse to the top of the screen, you will see the top bar.

    Is there a way to do not do? (You will then need to press F11 to get out)

    Add code to the file userChrome.css below default @namespace.

    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    #fullscr-toggler { display:none!important; }
    

    The file userChrome.css (UI) customization and userContent.css (Web sites) are located in the folder of chrome in the Firefox profile folder.

    You can use this button to go to the current Firefox profile folder:

    • Create the folder chrome (lowercase) in the .default < xxxxxxxx > profile folder if the folder does not exist
    • Use a text editor like Notepad to create a userChrome.css (new) file in the folder chrome (file name is case sensitive)
    • Paste the code in the userChrome.css file in the Editor window
    • Make sure that the userChrome.css file starts with the default @namespace line
    • Make sure that you select "All files" and not "text files" when you save the file via "save file as" in the text editor as userChrome.css.
      Otherwise, Windows can add a hidden .txt file extension and you end up with one does not not userChrome.css.txt file
  • I have just Setup iPhone 3GS from my wife. Through iTunes, I loaded music, Photos, Contacts, and calendar. There is no Photos icon on the screen. They are responsible because appear it as choices in the selection of paper painted. help please. Thank you.

    I have just Setup iPhone 3GS from my wife. I.O.S. 6.1.6. Through iTunes, I loaded music, Photos, Contacts, and calendar. There is no 'Photos' icon on the screen. The photos are loaded because appear it as choices in the selection of wallpaper. I would be grateful for any help with this. Thank you.

    Jimbo1307 wrote:

    I have just Setup iPhone 3GS from my wife. I.O.S. 6.1.6. Through iTunes, I loaded music, Photos, Contacts, and calendar. There is no 'Photos' icon on the screen. The photos are loaded because appear it as choices in the selection of wallpaper. I would be grateful for any help with this. Thank you.

    Double check the app folder or home screen.

    Cannot delete the built-in app, so go to settings - general - reset - Reset available to the home screen.

Maybe you are looking for

  • Satellite M100 - screen remains black after sleep/wake

    I just installed Windows Vista Ultimate on my Satellite M100 series. Everything works fine, but when the pc is forced into sleep/standby or it automatically goes into sleep/standby mode depending on the time of inactivity in the power settings could

  • OfficeJet 5740: New genuine cartridge does not work

    I just bought a new ink a few hours there are the target. I played the installation video and proceeded to the installation of the new ink cartridge. Once I had finished the following pop-up came, "remove and install the specified cartridge, ensuring

  • TouchSmart from HP 520 1050: hp 520 TouchSmart 1050 graphics card

    Is it possible to update the graphics card in this machine to something with a little more power? It would be nice to have a graphics card that can play games like World of Tanks for example. Recently, I have had this computer as a gift and noticed i

  • Huge * Log files _cur.txt

    Hello We have some difficulties that some applications hang up because he is somehow the operating system creates huge logs (see attachment) in the temporary folder of the user. This will up until him becomes completely exhausted HARD drive...! I rea

  • My problem with my cd/dvd drive

    Hi all My machine is running XP Professional. My problem is on the CD/DVD drive. In the normal state, when it is empty, it can be opened and closed just as usual. But for most of the CDes DVDes, a problem will occur.The problem is firstly that the CD