"In charge" trick when loading a bitmap.

Hello

IM developing an application that uses google maps API static. The application gets the imgs from google maps and he takes his time.

How can I draw a "Chargin" tip... "while an img is being downloaded?

I tried a few ideas, but I think the UI is painted by another thread and it does not work.

Thank you!

I proved many ideas and it works:

private void updateMap() {}
       
try {}

loading = true;
           
UiApplication.getUiApplication () .repaint ();
Bitmap img = gmap.getMap ();
imgField.setBitmap (img);
loading = false;
GoogleMapsScreen.this.invalidate ();
           
} catch (Exception e) {}
Dialog.Inform ("error al get the image:" + e.getMessage ());
}
       
}

protected void paint (Graphics graphics) {}
Super.Paint (Graphics);
{if (loading)}
Color int = graphics.getColor ();
graphics.setColor (Color.BLUE);
graphics.drawText ("Loading...", 10, Display.getHeight () - 50);
graphics.setColor (color);
}
           
}

Tags: BlackBerry Developers

Similar Questions

  • Charger changes the pixel value after loading as bitmap

    Hi all

    My goal is to load two images and compare its color pixel-by-pixel information. For this I used "flash.display.Loader' class to load the images, and once the load finished I catalogued the content loaded bitmap object (loaderObj.content as Bitmap). Finally, I'll get the bitmapdata of the bitmap of the two images and compare the pixels.

    Now the problem is the color of the original image information and the loaded bitmap is slightly different. For example, the color value of the pixels of the image attached image1.jpg is 0xDDDDDD for full 1366 x 768. And for the image even when it is loaded as bitmap color value of pixels are different from the original value (for a few pixels only, not all pixels are different).

    I gave you the source code and sample images.

    Please can someone help me how to solve this problem?

    <? XML version = "1.0" encoding = "utf-8"? >

    " < = xmlns:fx s:WindowedApplication ' http://ns.Adobe.com/MXML/2009 "

    xmlns:s = "library://ns.adobe.com/flex/spark".

    xmlns:MX = "library://ns.adobe.com/flex/mx".

    width = "1376" height = "800."

    ShowStatusBar is kept = "false" >

    < fx:Declarations >

    <! - Place non-visual elements (e.g., services, items of value) here - >

    < / fx:Declarations >

    < fx:Script >

    <! [CDATA]

    private function loadBtn_ClickHandler (): void {}

    var file:File = new queue (File.desktopDirectory.nativePath);

    file.addEventListener (Event.SELECT, onFileSelectionHandler);

    file.browseForOpen ('open image', [new FileFilter ("Images", "*.gif, *.jpg; *.JPEG; *.png")]);

    }

    private void onFileSelectionHandler(ev:Event):void {}

    var loadedFilePath:String = (ev.target as a file) .nativePath;

    loadImageAsBitmap (loadedFilePath);

    }

    / * Load the bitmap image using the loader * /.

    private void loadImageAsBitmap(url:String):void {}

    var loader: Loader = new Loader();

    load the content as a bitmap

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onContentLoadComplete);

    loader.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR, onContentLoadFail);

    Loader.Load (new URLRequest (url));

    }

    private void onContentLoadComplete(ev:Event):void {}

    var loaderInfo:LoaderInfo = ev.target as LoaderInfo;

    var bitmap: Bitmap = loaderInfo.content as Bitmap;

    printPixelValue (bitmap.bitmapData);

    container_ID. AddChild (bitmap);

    }

    private void onContentLoadFail(ioe:IOErrorEvent):void {}

    trace ("Image Load Failed");

    }

    private void printPixelValue(bmData:BitmapData):void {}

    var initPixelValue:Number = - 1;

    for (var countI:int = 0; countI < bmData.height; countI ++) {}

    var countI:int = 1;

    for (var countJ:int = 0; countJ < bmData.width; countJ ++) {}

    var pixelValue:Number = bmData.getPixel32 (countJ, countI);

    If (pixelValue! = initPixelValue) {}

    initPixelValue = pixelValue;

    Print pixel value for a single line

    trace ("value of Pixel to" + countI + "x" + countJ + "is:" + pixelValue);

    }

    }

    trace ("value of Pixel to" + countI + "x" + countJ + "is:" + pixelValue);

    //}

    }

    []] >

    < / fx:Script >

    < s:Button id = "loadBtn_ID" label = "Load!" click = "loadBtn_ClickHandler ()" "

    x = '5' y = "5" height = "20" / >

    < mx:UIComponent id = 'container_ID' x '5' = y = "30" width = "1366" height = "768" / >

    < / s:WindowedApplication >

    Sample image:

    main.jpg

    Thank you all,

    Update the sdk to 4.6.0 fixed the problem

  • Bug charger picture when defining data source dynamically

    I scanned old posts but don't see any reference to the problem/bug with Image/SWFLoader class.

    The problem is that when I insert different images in the same instance of the Image the Image instance does not empty the old bitmap data when the source is changed. For example, I have an application with a display of the Image making of .jpg whose names and source are in a list. A user clicks on an item in the list and the image is loaded into the instance of the Image (source property is set dynamically). What is totally unforgivable, he has the sense to use the same bitmap data if I reload the source of the image.

    No there is no way to get the Image class to empty its bitmap content?

    The only solution I can think of is trying to remove and re-instantiate the example Image when the user selects a new image to display.

    (BTW, I tested the above in Flex 1.5 and, of course, the old class Loader completely eliminated the old content when loading new content - just as it should be in Flex 2.0!)

    I found a way to remove the bitmap data from the loader on the blog of GSkinner:
    http://www.gskinner.com/blog/archives/2006/08/as3_resource_ma_2.html

    The trick is to access the bitmap data and call the dispose() method to erase it from memory. Why this has not been implemented in the first Image class is still a mystery to me...


    http://www.Adobe.com/2006/mxml"layout ="vertical">


    Import mx.controls.Image;
    private var blorch:Image;
    private void add (): void {}
    blorch = new Image();
    blorch.source = "images/P001.jpg";
    blorch. Width = 100;
    blorch. Height = 100;
    this.addChild (blorch);
    }
    private void remove (): void {}

    var bmp:Bitmap = blorch.content as Bitmap;
    var bmpData:BitmapData = bmp.bitmapData;
    bmpData.dispose ();
    this.removeChild (blorch);

    }
    ]]>


  • MBA crashes when loading

    Hello comrades! My trusty 2011 MBA 13 "served me wonderfully until he started to crash and restart very often (with the message"your computer restarted because of a problem", ==> http://i.stack.imgur.com/0Fpgn.jpg ).

    This happens only some time after it is connected to a MagSafe charger - my wife also has an MBA and the same thing happens when I use his charger, so I guess that this is unrelated to the charger. Also, since a few days ago the green light on the adapter is not always light up immediately - I must move a bit until it fits and starts to load effectively.

    Someone knows something similar? BTW, my battery seems to be ok according to system information:

    Battery information:

    Information model:

    Serial number: D8620930313DKRNAZ

    Manufacturer: SMP

    Device name: bq20z451

    Pack Lot Code: 0

    PCB batch number: 0

    Firmware version: 406

    Review of material: 000D

    Review of cells: 162

    Information on this charge:

    Charge remaining (mAh): 4486

    Fully charged: No.

    Loading: No.

    Full Charge capacity (mAh): 5257

    Health information:

    Cycle Count: 255

    Condition: Normal

    Battery: Yes

    Amperage (mA):-3095

    Voltage (mV): 7694

    Any ideas? It could always be connected to the battery? Or I might have something else (for example the MagSafe connector in the laptop) replace?

    Thank you!!!

    It seems that the MBA had a kernel panic.  Open a session and post it by these instructions:

    https://support.Apple.com/en-us/HT201753

    Ciao.

  • If it is good I turn off my IPhone6s when loading?

    If it is good I turn off my IPhone6s when loading? And it's good to load when 10%?

    Q1: he is indifferent to alll you use the iPhone or not care of everything.

    Q2: for a modern battery like the iPhone, it is best to start charging when more than 20%; never let iPhone die because of an empty battery, which is bad for battery life.

  • Three consecutive images load external bitmap

    Hello

    My question is very simple.  I just want to know that when loading three consecutive images in a line (via LOADER() and URLREQUEST()), if I only need to look to the completion of the last load of the image.  Or, all three files will load at the same time (the smallest file fill everything first)?

    In addition, the following URL relatative is acceptable?

    ".. /.. "/ Usifb/Images/Photos/Animations/WheelFreeTractor.png".

    Kind regards

    Ron

    It is unclear what order the files will be loaded unless you control the order by charging them sequencially.  To load them sequencially you must have a listener for each of them.

  • ("Not Responding") freezing when loading some Web pages

    When loading certain pages Web firefox crashes for a while with "(ne répond pas) ' at the top next to the page, also bringing Windows 7 Aero affect the top of the window instead of being hidden." Perhaps this lasts ten seconds give or take most of the time. Currently, the only websites I can remember this are newegg.comand youtube.com. I tried to disable hardware acceleration, this does not solve the problem. A similar problem if I recall still exists for drivers of some(not me) listed as a possible problem, so I'm running drivers Nvidia 344,48 WHQL, updates only after having this problem, and my GPU is a Nvidia GTX 770.

    Figured out, it seems to be caused by the add-on greenhouse. Disabled and have no problem.

  • two other programs to lose control of cursor when loading firefox. Nitro pdf &amp; on display at take-off from the software Center. Help, please

    two other programs to lose control of cursor when loading firefox. Nitro pdf & on screen takeoff on center software. Help, please.

    When I use the programs listed above and firefox is loaded, scrolling through these programs takes me at the edge of the window. I can't scroll 3 lines I can when FF is not loaded. I hate to say it, but FF is certainly the culprit.

    OK, if I may ask, what also happened when Firefox is in Mode safe? That will do this troubleshooting step, is whether this is caused by an add on that you have in your profile. Questions to troubleshoot Firefox in Safe Mode

    Moreover, the fact happen on the touchpad, as well as with an external mouse (if it's a laptop, if not, please ignore)Reset Firefox preferences to troubleshoot and solve problems

    Does this happen with accelerated scrolling on? This setting is in preferences/Options > Advanced Options > general

    Please post back with your results, thank you!

  • When loading a new site using Firefox, why do I get a message telling me that "firefox prevented this page automatically lead to another page." Allow? »

    When loading a page using Firefox, at the top of the page, I get a message saying "Firefox prevented this page from automatically redirecting to another page - allow? This happens almost every time I start a new page, and Firefox will not allow to continue the download. I tell him to allow every time, even on the pages I have "authorized" by the past.

    Clear the Cache and Cookies

    Clear the Cache of the network

    -> click on the Firefox button, then click on Options -> advanced-> general-> remove the check mark from the warn me when Web sites try to redirect or reload the page

    -> Click OK-> restart Firefox Options window

    Check and tell if its working.

  • Satellite Pro A40 - sound skips when loading programs

    PC: Toshibe Satellite Pro A40
    Sound card drivers: Soundmax integrated digital audio

    Hello

    When I bought my Toshiba Satellite Pro A40 my audio is not affected by loading programs and any other activities that could slow down my computer.

    I had to resinstall windows a few months back when my HD crashed.

    I reloaded all my drivers etc. and installed itunes.

    When I play music or any audio I listen to jump seriously when loading programs or when processes are performed on my computer.

    This used to be the case, I tried to change my settings from quicktime to run in safe mode, I even now deleted quicktime and itunes that I thought it was the source of the problems.

    Nothing worked, my sound is still seriously affected when my processor is busy

    I uninstalled, reinstalled my sound card drivers, but nothing has worked...

    I would really appreciate it if you have all the settings I could change to stop this problem.

    My voice through my microphone breaks a lot, so the people at the other end of a VOIP call can barely hear me... it's driving me crazy!

  • Satellite A30: Error number (11122) cannot load the bitmap with recovery CD

    I have a Toshiba A30 I want to reformat with the recovery disk. I get that day then I get an error that reads:

    The error number (11122) cannot load the bitmap file. Height max = 100

    The hard drive has now been deleted and I can't sent this message to reformat.

    Can someone help me on this please.

    Hello

    Satellite A30 is quite old and I wonder what report you something like this after so long. I put t know exactly what is happening, but it will be interesting to know a few things:

    Have you noticed a similar problem before?
    Are you using the original disk or some copy?
    Is there a problem with the HARD drive?

    Please do a little bit more about these things.

  • Satellite L675-11R - crashes when loading the BIOS

    Hello

    My daughter L675 crashes when loading the BIOS.

    Yesterday the system firstly could not start with a "Boot failed" error, as the HARD drive is not found.

    I restarted and is gone in BIOS - the HARD disk was recorded and shown as a first Source of seed. After reboot, the system has failed again with the same error.

    After several attempts, even if it does not. now that appears in a black screen, blinking cursor top left. Hot start works, but another key not seem to provoke a reaction. I can't start the BIOS Setup.

    I removed the HARD drive and connected it to my PC. It was recoginized and I am able to write to it. A W7 disk verification completed successfully and some problems have been "fixed". But when I reinstall the drive of the laptop, it still does not start.

    I double checked that the drive & Modules of memory are well inserted.

    Any ideas I can try?

    Thank you

    John

    Well, the cursor blinking in the upper left corner is a typical sign of a malfunction of the HARD drive.
    I think you need to format the HARD drive using other computers. Delete all partitions and insert the HARD drive into the L675 again.
    Then try to install the Windows system on this device.

    In addition, you can try to check this HARD disk using a 3rd party software.
    Drive Fitness Test is a free tool that can help you test the ability of the HARD drive.
    If some errors would be detected, then a replacement HARD drive would be desirable.

  • Satellite L500-19 x crashes when loading dvd software

    Satellite L500-19 x crashes when loading dvd software. It's photoshop elements 9. Other software by load generally okay, but not always.

    Any ideas?

    Hi shownomercer,

    Have you tried the Photoshop disc in another computer to check if the installation disc is ok or not?

    What exactly happens when the computer crashes? Blue screen?

  • iTunes does not charge enough when synced to my car

    iTunes does not charge enough when synced to my car

    This forum is for the application of music notes... This is the wrong forum for your question.

  • WSN-3212 or NI WSN 3202 when loaded with VI target with

    WSN-3212 or NI WSN 3202 when loaded with a new firmware using option "Add LABView WSN target", cannot re connect with the gateway ethernet OR WSN - 9791. In MAX, the quality of the link state is "lost Signal".

    Basically, I tried to change the sampling in the sample interval ""case structure, then built the VI and deployed on two WSN nodes. " They show the status of the download of the firmware and the LABView also shows the message 'successfully deployed", but then, knots just to start scanning and never connect again.

    Please help in this regard.

    Hello binarystar105,

    When you have downloaded the new firmware, did you follow the steps described in this article?

    How to upgrade the Firmware on my NI WSN gateway?

    http://digital.NI.com/public.nsf/allkb/CF6241F5F849FC7086257909008327C5?OpenDocument

    Also, what version of firmware you currently have?

    What version of the LabVIEW WSN Module work?

    If you look at the properties of the node of your window from the LabVIEW Project Explorer, can set you the tab node sampling interval?

    You may already familiar with this material, but I found the following white paper to be extremely useful when I started working with WSN:

    Getting started with wireless sensor networks of NOR

    http://www.NI.com/white-paper/8890/en/

Maybe you are looking for