bitmaps in ListField - is the right way to do it?

I want to create an image list (named 0.png, 1.png, 2 png etc.) and I want to put them in a ListField. in the reminder for this listfield class, I have the following:

public void drawListRow(ListField list, Graphics g, int index, int y, int w)
{
    for (int i = 0; i < list.getSize(); i++)
    {
        b = Bitmap.getBitmapResource(i + ".png");
        g.drawBitmap(new XYRect(0, i*(list.getRowHeight()), b.getWidth(), b.getHeight()), b, 0, 0);
    }
}

is this the right way to make a list of images (i.e. it is the fastest way)?

I would like to store the images in a table of initialized Bitmap previously, rather than read them each time that a line should be drawn.

Also, drawListRow is only meant to draw a single line, whenever it is called. Finally, I would not build a XYRect each time, which makes the work more garbage collector. Use the version of drawBitmap plus-arguments:

public void drawListRow(ListField list, Graphics g, int index, int y, int w) {
    g.drawBitmap(0, y, w, list.getRowHeight(), image[index], 0, 0);
}

( image is the array of bitmaps initialized using the previous loop.)

Tags: BlackBerry Developers

Similar Questions

  • I close Firefox the right way every time. Why dose he keep saying opps seems firefox crashed... Each time...

    I checked all of the updates and there is no... Why dose Firefox keep saying OPPPPPS well this is embarrassing, seems that your session broke down... Well I know not down because I close every time the right way to dose... Can someone tell me how to solve this problem... It's really annoying... Also, I tried each and everything I thought to try and nothing works...

    Hello Marlin29, this is currently an issue in firefox when you close all firefox windows open first and then close the application subsequently - the bug should be addressed in a more recent version of firefox.

    a workaround in the meantime, you could close firefox (via firefox > quit) while the browser window is still running or try this: enter: config in the firefox address bar (confirm the message information where it appears) & search preference named browser.sessionstore.resume_from_crash. Double-click it and change its value to false.

  • What is the right way to stop an external hard drive please?

    What is the right way to stop an external hard drive please?

    Take it down to disk utility

  • What is the right way to recharge the iphone 6

    What is the right way to recharge the iphone 6?

    Hello

    Follow the instructions here to recharge your iPhone:

    Recharge your iPhone and iPod touch - Apple Support

  • The screen upside down - why? How can I return it the right way up?

    My screen is upside down, no idea how it back to the right way to the top?

    Press Ctrl & Alt keys and use the arrows to rotate back.

    According to the graphics card on your computer, these can be alternatives.

    Right click on the desktop | Graphics options | Rotation.

    Right click on the desktop | Screen resolution | Orientation.

  • What is the right way to allow multiple developers working on the same .uir using Subversion?

    We are two developers working on the same .uir at the same time. Y at - it all the tools that would allow us to merge our own changes? If not, is there a way to avoid us to make changes at the same time.

    For now we are only two, so the problem could easily be fixed by talking or other shipping when the changes should be applied. In any case, I would like to know the right way to work to ignore this issue.

    Thank you!

    Enjoying a beautiful UIR: Options / Save in Text Format...

  • How to change dyou from Korean to English and time date thing dones t work is English version 1.0 of the right way to do it on a wiodows xp home

    How can we change from Korean to English and time date thing doesn t work is English version 1.0 of the right way to do it on a windows xp family

    Hello

    Refer to these...

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-windows_programs/how-do-you-change-Korean-to-English-please-help/0adfb674-886d-440d-8a86-37adcb9a305b

    It comes to English instruction to change the regional language. This will not change any Korean in all English unless your computer is running XP Pro Corporate. The only way to change all Korean at all English is by reinstalling Windows with the English version.

    http://www.computing.NET/answers/Windows-XP/Windows-XP-language-from-Korean-to-English/178270.html

  • What is the right way to add a language?

    Hello
    I wanted to show traditional Chinese web pages with Chinese characters
    (for example, hk.yahoo.com).

    I walked into the tab Control Panel / regional and language options/languages
    and choose "install files for East Asian languages".   He asked for the XP CD,
    installed something and seemed to work.

    However, it seems to have turned on a few items for the language entry,
    from what I see in the boot options.  I don't want to enter the Asian languages,
    show only the Chinese web pages.

    What is the right way to set up and get rid of all this stuff related to the input method?
    (the first 4 points here)

    http://ImageShack.us/photo/my-images/341/StartupItems.jpg/

    Richard,
    I have done work similar to what I described.

    I deselected "install files for East Asian languages" as I mentioned above,.
    removed startup items which appeared in msconfig (you can see the 4 in the JPG I posted)
    and restarted.  What this does in fact, I'm not sure.
    Is it uninstalled or disabled just something, I'm not the wisest.
    (For example, the fonts themselves)

    I open IE8 and went to a page where the Chinese characters should be displayed.
    Instead of characters, the text appeared as small squares. But after playing with
    view/encoding, it began to appear normally.  What ever he did, he also worked for Firefox.
    I found a page posted elsewhere mentioned IE8 can you will prompt to download the
    Chinese police if it is not installed.  This moved not, makes me wonder if it was
    there all along.

    Of course, all the other windows dialog boxes and other parts of the interface.
    are English, as it should.  As far as I know, looks like it works the way
    I wanted to.

  • I wipe my keyboard and mouse with a paper towel and the screen flipped sideways, how I recover the right way? /

    I wipe my laptop and keyboard mouse with a paper towel and the screen turned sideways, how I recover the right way?

    Hi ken1957,

    Try pressing Ctrl +or to rotate the screen.

  • On a 32-bit vista business system, what is the right way to recover from a damaged NTLDR file that prevents the system from booting?

    On a 32-bit vista business system, what is the right way to recover from a damaged NTLDR file that prevents the system from booting?

    Also, is there a powerful device filled, utility like Winternals Windows PE boot, I can download for the resolution of problems like this and others?

    Thank you in advance!

    Have you had a glance at this startup repair disk?

    Download the ISO on the link provided and make a record of repair time it starts.

    Go to your Bios/Setup, or the Boot Menu at startup and change the Boot order to make the DVD/CD drive 1st in the boot order, then reboot with the disk in the drive.

    At the startup/power on you should see at the bottom of the screen either F2 or DELETE, go to Setup/Bios or F12 for the Boot Menu.

    When you have changed that, insert the Bootable disk you did in the drive and reboot.

    http://www.bleepingcomputer.com/tutorials/tutorial148.html

    Link above shows what the process looks like and a manual, it load the repair options.

    NeoSmart containing the content of the Windows Vista DVD 'Recovery Centre', as we refer to him. It cannot be used to install or reinstall Windows Vista, and is just a Windows PE interface to recovering your PC. Technically, we could re-create this installation with downloadable media media freely from Microsoft (namely the Microsoft WAIK, several gigabyte download); but it is pretty darn decent of Microsoft to present Windows users who might not be able to create such a thing on their own.

    Read all the info on the website on how to create and use it.

    http://NeoSmart.net/blog/2008/Windows-Vista-recovery-disc-download/

    ISO Burner: http://www.snapfiles.com/get/active-isoburner.html

    It's a very good Vista startup repair disk.

    You can do a system restart tool, system, etc it restore.

    It is NOT a disc of resettlement.

    And the 32-bit is what normally comes on a computer, unless 64-bit.

    See you soon.

    Mick Murphy - Microsoft partner

  • The right way to face the camera and camera on standby?

    How one brings the camera back to life after the unit returns to standby mode?  What is the right way to manage the device sleep and wake?  Any help is appreciated.

    Hi Sucroid,

    I intend to produce a sample that shows this I hope that during the holiday season.

    Here is some information that can hopefully help you get started...

    When the screen goes to sleep, off camera equipment.  There is nothing you can do about it today, outside of the application one keep awake in your application window. (value SCREEN_PROPERTY_IDLE_MODE SCREEN_IDLE_MODE_KEEP_AWAKE).  Note that this won't save you a user who clicks the power button to force the unit in standby mode.  It will protect you against a situation where your application goes to background or another application requires video resources that are used by the camera.  In these two situations, your application will lose his viewfinder.

    But all is not lost!  There are some events of status, you can listen to that lets you know that the camera stops.  You can listen to these events either with an attached status_callback (applied when starting the viewfinder for example), or by authorizing explicitly state the events using camera_enable_status_event() and waiting for impulses of status.  All these things are detailed in the documentation for the API of photo here: http://developer.blackberry.com/native/reference/bb10/com.qnx.doc.camera.lib_ref/topic/overview.html

    The corresponding lights events are:

    CAMERA_STATUS_RESOURCENOTAVAIL - this event is logged every time that the camera is about to close.  If you have previously called camera_register_resource(), this is the event that listen to you to know that all your camera buffers are about to be démappés - so stop all logic that looks at them and then camera_deregister_resource() camm.  If you do not physically the buffers of viewfinder, then necessarily no need to use this registry/invert mechanism.  It's just there to provide warning and to activate the drivers of the device for you to recognize that it is safe to unamp wait for memory.  Each time the screen goes to sleep, the power button is pressed, or another application has need of resources of the camera, you will get this signal.  If you are curious to know the reason, you can check the 'extra' uint16_t argument in the callback of the situation for one of the camera_powerdownreason_t values.  All video recordings currently active or encodings auto-terminera when this signal is received.

    CAMERA_STATUS_POWERDOWN - event status is reported immediately after the hardware of the device is turned off.  You can't interact more with the camera until this condition is removed.  Note that to capture this event, you will need the user of the status of the event-mode (camera_enable_status_event()) interface, because any reminder of status you can have attached when starting the viewfinder will be cleaned up when the viewfinder stops.

    CAMERA_STATUS_POWERUP - event status is reported immediately after that camera material is fed up after having previously be put off.  Even not not on using status of event-mode interface (camera_enable_status_event()) applies in this case too.

    So, what can you do with this information?

    Well, tuned for CAMERA_STATUS_RESOURCENOTAVAIL will tell you when your viewfinder will close.  At this point, your application must enter a State where he is waiting for an event that will wake it again...

    In most cases, this is the event browser that indicates your application is active or foreground again (NAVIGATOR_WINDOW_ACTIVE or equivalent).

    So when your application is told by browser is it back to the foreground, you can then restart the viewfinder using camera_start_photo_viewfinder() or camera_start_video_viewfinder() according to the requirements of your application.  You will still need to follow the same recipe to start the viewfinder as a cold start your application (for example. Wait for the window of your viewfinder to be filled), but you will not need to reconfigure all the settings.

    OK... which covers 99% of the use cases that you will encounter.  Use case for the 1% remaining, you will need to follow for this CAMERA_STATUS_POWERUP event.  Why?  Well, there is a race condition when things down, in which case if the user wakes up the device while the camera is closing (eg. they struck twice in quick succession, the power button), then the camera will enter its off State, but navigator may actually not report your application it becomes idle.  This is because the infrastructure of power management is waiting actually for the material from the camera to the power off until the system goes to sleep.  If the user wakes up the device upward, then this action is canceled, and the unit enters never actually standby.  In this case of corner, navigator does not say your app to become active, again because he never told your application becomes idle.  So what are you doing?  Well, I have 2 suggestions:

    1. You can follow to CAMERA_STATUS_POWERUP using the event interface mode for the camera equipment.  It's actually the more correct approach and what we are doing internally with the BB10 camera App.
    2. You can use a timer to try to wake up the camera in the case of this corner case occurred.  for example. wait 5 seconds after the signal CAMERA_STATUS_RESOURCENOTAVAIL.  If your application has not been made inactive by browser, then you can try turning it back on the camera.

    I hope this help get you pointed in the right direction and still... I plan on collecting a best-practice appropriate sample that illustrates exactly how to do this when the weather!

    See you soon,.

    Sean

  • SQL use the previous value of subselect in the subselect, the right way?

    Hi all!

    Today is Friday and I got a problem.

    I try to use the value of the previous Subselect statement in a subselect statement but could not find the right way to do this , need help and advice

    Error: [1]: ORA-00904: "PARENT_ID": invalid identifier

    Error on line 5

    SELECT INITCAP(aapt.pow) , aapt.woj ,
    (SELECT id FROM adm_address aad where aad.name = INITCAP(aapt.woj) AND aad.address_type ='N') as parent_id,
    
    
    (SELECT id FROM adm_address aad where aad.name = INITCAP(aapt.pow) AND aad.address_type ='D' AND aad.adm_addres_id = parent_id) as id
    
    
    FROM AMD_ADDRESS_PL_TMP aapt  GROUP BY pow,woj
    
    

    Guaraanteed of helpful answers!

    Thank you!

    Hello

    You can't do that. You should probably use a hierarchical query instead of your scalar subqueries to extract lines children and parents and then join the AMD_ADDRESS_PL_TMP table.

    Moreover, why the clause GROUP BY here?

  • I bought Lightroom Version 3.0 in 2009. Now, I want to install Version 6.3. on a new laptop. What is the right way?

    My older Version 3.2. is to install on PC with Windows XP. The new book has 10 Windows.

    First I got trey to install 3.2. in Notepad. I hope that the serial number will be displayed. Then, I want to do the upgrade 6.3. by a download.

    What is the right way?

    Thanks for the reply.

    Please Install Photoshop Lightroom from here. You can check: How to download, install and activate Adobe applications here.

  • What is the right way to migrate from the PS CS5 and LR5 from my old Mac Pro to my new iMac 5 k?

    I am ready to migrate my boot drive for the new iMac and I worry about the right way to take my Adobe Ps and Lr, Br on the new computer. I migrate disable on the old machine, or disable and remove and reinstall on the new iMac? I don't want to spoil!

    Yes, you can install from your original discs as well.

  • Team Snap Widget - causing me headaches - try to add pictures to the assets, cannot be done, what is the right way to add the team head shots?

    Team Snap Widget - causing me headaches - try to add pictures to the assets, cannot be done, what is the right way to add the team head shots?

    Hello

    Try using the file-->. Add files to download in Muse

    Navigate to your image so that it gets added to the active panel.

    Then in the options menu for the flip team widget, change the 'image' of assets/image_name.jpg path option

Maybe you are looking for