Retrieves the width of screen

Hi team,

I have a following code:

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.i18n.*;
import net.rim.device.api.system.*;
import net.rim.device.api.collection.util.*;
import net.rim.device.api.ui.decor.*;

import java.util.*;

public final class SeedAboutScreen extends MainScreen implements SeedManagerResource
{
    //members ------------------------------------------------------------------

    private static ResourceBundle _resources = ResourceBundle.getBundle(BUNDLE_ID, BUNDLE_NAME);
    private static SeedHelpScreen _seedHelpScreen;

    private VerticalFieldManager _manager;

    public SeedAboutScreen()
    {
        super();

        _manager = (VerticalFieldManager)getMainManager();

        BitmapField image_top = new BitmapField(Bitmap.getBitmapResource(_resources.getString(IMAGE_TOP)), FIELD_HCENTER | FOCUSABLE);        

        Background image_background = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource(_resources.getString(IMAGE_BACKGROUND)), 0, 0, Background.REPEAT_INHERIT);

        BitmapField image_logo = new BitmapField(Bitmap.getBitmapResource(_resources.getString(IMAGE_LOGO)), FIELD_HCENTER | FOCUSABLE);

        _manager.setBackground(image_background);  

        Font font_title = this.getFont().derive(Font.PLAIN | Font.BOLD);
        Font font_application = this.getFont().derive(Font.PLAIN, 16);
        Font font_bold = this.getFont().derive(Font.PLAIN | Font.BOLD, 16);

        LabelField _titleField = new LabelField(_resources.getString(APPLICATION_TITLE), FOCUSABLE);
        LabelField _descriptionField = new LabelField(_resources.getString(APPLICATION_DESCRIPTION), FOCUSABLE);
        LabelField _versionField = new LabelField("Version: " + _resources.getString(APPLICATION_VERSION), 0, -1, Field.FIELD_RIGHT | FOCUSABLE);

        _titleField.setFont(font_title);
        _descriptionField.setFont(font_bold);
        _versionField.setFont(font_bold); 

        try {

            _manager.add(image_top);
            _manager.add(_titleField);
            _manager.add(new LabelField(" "));
            _manager.add(_descriptionField);
            _manager.add(new SeparatorField());
            _manager.add(_versionField);
            _manager.add(new LabelField(" "));

               }
        catch (IllegalArgumentException e)
            {
           System.out.println(e.getMessage());
            }
    }

    public boolean onClose()
    {
        _seedHelpScreen = new SeedHelpScreen();
        UiApplication.getUiApplication().pushScreen(_seedHelpScreen);
        return true;
    }

    public boolean keyChar(char key, int status, int time) {
        //intercept the ESC key - back out of this screen on its receipt
        boolean retval = false;

        switch (key) {
        case Characters.ESCAPE:
            onClose();
            retval = true;
            break;
        }

        return retval;
    }     

    private MenuItem _closeItem = new MenuItem(null, 0 , 200000, 10) {
        public void run() {
            onClose();
        }
        public String toString()
        {
            return "Close";
        }
    };

    protected void makeMenu ( Menu menu, int instance )
    {
        menu.add(_closeItem);
    }

}

I need get the screen width to create the following option:


        Switch (widthScreenDevice())

         case 480:                BitmapField image_top = new BitmapField("image 1.png");           case 320:            BitmapField image_top = new BitmapField("image 2.png");  ...

I have no idea about this, please help me.

Thank you.

Hello

Take 2 static public variables called deviceWidth and deviceHeight and initialize these variables with

deviceWidth = Display.getWidth () deviceHeight = Display.getHeight () and

Initialize these variables in the constructor of the class that contains the main() and then use these variables in your application.

Tags: BlackBerry Developers

Similar Questions

  • Retrieve the width/height of the Applet in form 10g

    Dear members:

    Is it possible that I could capture width & height of applet, which has been formsweb.cfg the runtime - appreciate your suggestion.

    Thank you.
    Adam

    Hello

    It is a solution with A Java Bean


    François

  • How can I stop him adding that pop multiple bookmarks - up to fill the width of the screen?

    Whenever I try to add more than one link to my favourites, the pop-up that asks to add these links fills the width of the screen. It happens when I try to add all of the current tabs to Favorites, as well as when I use the add on, multi links. This makes it very difficult to add links because I have to go across the screen to find the ok button.

    I want to resize the pop up to a more manageable size. However, even though I should be able to resize, I can't figure out how. I also tried to minimize it, but the next time I tried to gather more bookmarks, it was back to the large size again.

    After validation, I tried once more to resize the pop-up. This time, it worked, and it seemed to stick. I think that I could have an add on (multi link). I thought I had tried resizing without which adds be on. I already knew that I was unable to use the search functions on different sites with the add on assets.

    So my problem has been resolved. Even if I don't know what caused the large size first.

  • How to display the width of the page or the big screen in firefox 11 automatically?

    How to display the width of the page or the big screen in firefox 11 automatically? I know how to Ctrl +, ctrl - and ctrl 0, but is there a way to define 11 firefox to automatically set the page viewing by default "page width" or full screen (F11 not)?
    Help, please. Thank you.

    You can use an extension to set a page zoom and the size of the default font on the web pages.

  • How to change the width of the image on the screen?

    How can I change the width of the images on my screen?  Everyone seems wide.  How depressing!

    It may be interesting to try to change the resolution of your screen.

    See the following...

  • The width of the preview in Windows Explorer screen can be hung on the left side instead of the right side?

    Whenever I open a Windows Explorer window, the preview window to adapt is questionable.  It is anchored on the right side of the window.  Sometimes it's fine, other times, it covers more important data like date/time and file size.  If I have it full screen on my wide screen, everything is great, but when I throw it in my smaller screen, everything must shrink.  Rather than shrink the preview pane, it allows the preview pane cover the most important areas.

    The width of the preview in Windows Explorer screen can be hung on the left side instead of the right side?

    I don't think it can be docked to the left.  I know that the sector details can twisted to put it on the bottom rather than the side (like Vista/7), but the preview pane itself isn't such a tweak.

  • How to fix the screen on DW width to match the width of the web page?

    I have DW CS4 on my PC. How can I get the DW screen width to match the same width of screen on the website.  The screen on DW is plus sized and I need to use the sliding bar at the bottom to see the complete form. When I place pictures in a text file and load the file on the web, they are lined with Miss placed and sometimes longer. The percentage of the screen does not solve the problem. Help!

    Close all panels and Panel groups.  Resize the design Panel by dragging the edges of the Panel in the widest possible.

    When I place pictures in a text file and load the file on the web, they all move them and sometimes more polished.

    This means a much bigger problem than the size of the screen.  More like a design approach and the vitiated provision.

    Despite what you may have been led to believe, the Design view is not and has never been WYSIWYG.  At best, it's an approximation of what you might see in some older browsers.   Live View is a little better at rendering of page but preview locally in real browsers is essential.

    Nancy O.

  • How to make a PDF automatically by default from the entire length of the screen of the computer, but not the width of the full screen?

    How do a default PDF file open the length of the page, but not the width of the full screen?

    Acrobat Reader cannot change the parameters of the PDF document.

  • Script needed downtown Zoom image to fit the width mode full screen

    So here's the situation: I am full screen/no menus and I would like an image to center the zoom to fit the width of my screen. This would save some time by rubbing the zoom.

    Does anyone know a script out there that would do exactly that? I could assign a keyboard shortcut, and it would be a time saver.

    Photoshop CC 2015.0.1/OSX 10.10.5

    Gene

    And when you use the button of the screen fill zoom than nothing is registered by the logger Plugin or scriptlistener Action. When your layout fullscreen it no way to get to the screen from filling key, there is no. If you use the button before switching to fullscreem mode when you enter mode full screen zoom level of the image does not fill the screen.

  • How to set the width of layout desktop screen in fluidlayout?

    For the flow layout of RWD, Web site design page I have is 960px wide. While working on DW CC, the width of sizes of support are:

    Mobile: width: 86,45%;

    Shelf width: 90.675%;

    Desktop width: 960px;

    When I set a percentage for desktop (for 960px), 68.6% (which is less mobile and the width of the Tablet), the browser displays more width 960px. Use a screen resolution of 1680X1050px.

    Now how to set the size of layout as 960px for desktop, in percentage?


    Or should I keep it as 960px for office and percentage for mobile and Tablet?

    68.6% of 1680px equals 1152px, then Yes, he is bigger than 960px

    If you want to stop at the 960px available, then set max-width: 960px to the container as well as width: 68.6%.

  • Width of the div on screen

    I have a big div (used as container) and a few smaller that div. smaller divs have defined width, and width of the container is based on the sum of the small divs. Is it possible to define a div so it could automatically auto trimming to match the screen resolution (div is the width of 1381px), or I have to redefine the image used for the div?

    Use static images not resized to the width of the screen.  If they did, they would look deformed.

    As a general rule, you choose a width of page is comfortably displayed by the majority of visitors to your site without having to use the horizontal scroll bar.

    Fixed width (pixel-based), centered layouts are more comfortable to work with.  I think this is why many designers of web sites, use them.  The trick is to find the 'right' width for your target audience.  For most desktop and laptop users, 900 to 1100px is a good range.  For mobile devices, 320 to 480px.

    Related link:

    Google labs - the browser size

    http://browsersize.googlelabs.com/

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    http://ALT-Web.com/
    http://Twitter.com/ALTWEB
    http://ALT-Web.blogspot.com

  • Pass elements according to the width of the browser & full screen video backgrounds

    Hallo,

    Possible how ist create with Adobe Muse, a Web site like this: http://www.bootsprinting.com

    Hi Chris!

    Just to translate the a little bit for others who may read this thread in the future... ;^)

    You can get this result within the Muse by creating a block of text that is 100% browser width (the width of the text block to align the edges left and right of the background of the browser are in drag Muse). Then take the sets of items that you want to have "reformatting" and each set of group. Then cut it, click an insertion point in the 100% width text block and paste. At this point, you have a group that behaves as a single character of text/letter. Repeat for each item you want "reformatting". You can use the text tool to select the entire document in the text frame and focus.

    If you can get a glimpse into the browser and close browser resizing adapt not enough groups that you pasted in the block of text on a single line, they will wrap to two, three, lines etc. and the text block, they'll grow in height, if necessary. You can also use paragraph withdrawals to adjust the width of the browser in which the packaging occurs.

  • How can I use the width of the full screen while using fluid grids?

    Start playing with fluid on the CS6 networks. If you start with the fluid grid model, in the arrangement of office (for example), the gridContainer is wide of 88.5%. It seems that you should do everything in the div. gridContainer That being said, if I want to create different visual effects on my page that use a real 100% width, how can I do that and stay within this structure/design methodology?

    Sounds pretty basic, but I don't want first to break the rules or hacking in a work around

    Thanks in advance.

    Donna

    Starting with the design of FG, you can set the widths of 100% in the new Document dialog box

    If you already have in the design of your page, you can change the gridcontainer classes in your css as below

    {.gridContainer}

    left margin: auto;

    margin-right: auto;

    Width: 100%;

    padding-left: 0%;

    padding-right: 0%;

    Clear: none;

    float: none;

    }

  • Satellite Pro L870-172 error 003 when retrieving the recovery DVDs

    Hi all

    Having a devil of a time with this portable darn. So I bought the recovery dvd. tried to boot from the disk and comes with no OS bootable. Thinking it could be a problem with the optical drive, I created a bootable usb key.

    Received the usb key to start

    So I goto Toshiba Recovery Wizard
    Press Yes to say it will wipe the drive.
    Retrieves the software factory default
    In the end, I get an error message

    Error: 003
    Recovery error

    Press ok to start the computer

    You can see the final screen here.
    https://DL.dropboxusercontent.com/s/1fq5yk4t9hjhmk9/2014-09-05%20at%2012.38.PNG?DL=0

    Can anyone help plleeaaaseeee.

    The only thing I can think is that maybe when I created the USB startup key should I copy then disk2 on the stick as well using xcopy.

    I think there are several reasons for the error.
    The recovery media or the hard drive is may be defective. Wrong settings of the BIOS, etc...

    I recommend you to check once more the Toshiba Recovery bootable disc.
    I don t think that there might be a problem with the optical disc drive.
    From my point of view, it could be a bad BIOS setting.

    The Satellite Pro L870-172 has been pre-installed with the system Win 8.
    Please check start secure as well as the UEFI boot mode option in the BIOS.

    Generally, in order to be able to boot from different devices to boot, secure boot must be disabled.

  • Cannot reduce the width of the window of Bluetooth File Exchange

    The width of the window of the Bluetooth File Exchange application can not narrowed, has increased. How can I reduce the width of the window or reset default window width?

    I use the Bluetooth File Exchange to browse files on a device (in my case, a Windows laptop). The application works normally, but I can't reduce the width of the window. The resizing handles only the increase in bandwidth. The height can be increased or decreased as you would expect.

    This image shows the width handles can only increase the width. Now, after playing with resizing, the window is wider than my iMac 27 "screen. I see no way to reduce the width of the window. Any help would be greatly appreciated.

    Wow, good question...

Maybe you are looking for

  • Video HTML5 will not be full screen on the second monitor?

    While playing a Html5 video full screen on my second monitor, whenever I try to do anything else the video mode full-screen. Video Flash works very well and will stay full screen on my second monitor. I also tried the same Html5 video in Google chrom

  • How to adjust the brightness with windows xp

    My screen is too bright.  How can I set the screen to lower it for windows XP

  • Several WMI errors, and I don't know what to do:)

    I have a DELL inspiron 1545 Windows Vista Home Premium 64 x. help: () I don't understand any of this either. The WMI Diagnosis wrote: .1816 17:26:30 (0) * WMIDiag v2.1 began Sunday, July 1, 2012 at 17:24..1817 17:26:30 (0) *..1818 17:26:30 (0) * copy

  • WRT160N: DHCP but manual DNS?

    You just bought a WRT160N. Is it possible to set up to use DHCP but manual entry of information from DNS server? I would like to use OpenDNS instead of the DNS servers of my ISP, nd did this on my old Netgera router (which replaces the linksys). On t

  • Aironet 1200 with a radio and 802.11 g

    Can an AP 1200 with an 'a' and 'g' radio be used as a bridge (for backhaul) "one" of the radio and a point of access to the radio of 'g' at the same time? Thank you Kim