How to create a button in Blackberry?

I want to create a button through States: off (bitmap1) and, when clicked on it (bitmap2).

I know how to focus and unFocus. But I want to change the image of the button when it is selected and maiitien this second bitmap.

It is possible to do in Blackberry?

This demo of the sample can help you: try this in a separate file;

public final class LoadingScreen extends MainScreen
{
    private boolean isClicked=false;
    BitmapField facebook;
    Bitmap facebookBit=Bitmap.getBitmapResource("f.png"),facebookBitHover=Bitmap.getBitmapResource("f_h.png");
    public LoadingScreen()
    {
        isClicked=false;
        createGUI();
    }

    private void createGUI()
    {
        add(new LabelField("Click the Below Image",Field.FOCUSABLE));

        facebook=new BitmapField(facebookBit,Field.FOCUSABLE)
        {
            protected boolean navigationClick(int status, int time)
            {
                if(isClicked)
                {
                    isClicked=false;
                    facebook.setBitmap(facebookBit);
                }
                else
                {
                    isClicked=true;
                    facebook.setBitmap(facebookBitHover);
                }
                return super.navigationClick(status, time);
            }
        };
        add(facebook);

    }
}

===========================================================================

Do not hesitate to click LIKE button if the solution is correct;

Tags: BlackBerry Developers

Similar Questions

  • How to create a button like the one pictured here

    How to create a button in the button "print" below?

    I was actually thinking of doing it two separate buttons placed side by side. The "print" button, of course would be just updated the Boolean value, that is easy. But the drop down menu is a bit more difficult. I tell myself that I could customize a drop down, but because I was not able to play with it in LabVIEW (don't have it at home) I don't know if you can change the alignment of the drop-down box actually etc. The decline is down to the location of the box and look like something you can change in the control editor?

    I guess I could also use correct .net? But I'll try to keep it all with just control editing in LabVIEW if possible. Thank you.

    for (imstuck).

    I use a listbox multicolumn and toggle visibility is when the user clicks the button.  I've attached an example:

    ~ Simon

  • How to create a button icon / browse files

    Hi all, I have 2 questions I want to ask you:

    1. how to create a button icon using action script?

    I add this part of the code at the top of my file .as just below the keyword package:

    [Bindable]
    [Embed(source="/images/pause.png")]
    private var pauseIcon: Class;

    I then added, in the main function, copy the following code:
    var pauseButton:Button = new Button();
    pauseButton.setStyle ("icon", pauseIcon);

    The compiler problem with the "private var pauseIcon: Class; ' line and the new line of declaration of button.  I declare the type of button?

    2. how to browse files in the Simulator? I try to use browseForOpen, but it does not work.  It shows a blank dialog box saying no file meets my criteria.

    My code for browsing the files:

    var docFilter:FileFilter = new FileFilter ("Files", "*.") *") ;

    var myFile = File.applicationStorageDirectory;

    myFile.browseForOpen ("Open", [docFilter]);

    Thank you

    The embedded definition must be within the class as a normal attribute / member of this class.  You have outside the classroom.

    [SWF...

    SerializableAttribute public class Main extends Sprite

    {

    [Embed(source="/image/player_pause.png")] private var pauseIcon: Class;

    public void Main()

    {

    var btn: IconButton = new IconButton();

    btn.setIcon (new pauseIcon());

    this.addChild (btn);

    }

    }

  • How to create a button that opens the attachment (file power point attached to the pdf document)

    Hello world!

    The question is in the title.

    How to create a button in Acrobat Pro to open a file attached to PDF?

    I have moved your question to one of the forums of Acrobat, first.

    If the target file is not a PDF file you need to use a script to do it. The structure of the script would be something like this:

    this.exportDataObject ({cName: "Name of the attachment.ppt file", nLaunch: 2});

  • How to create a button 'Click me' on a pop up image?

    How to create a button 'Click me' on a pop up image?

    It does not work like that.

    Links are created with HTML code.

    They must be inside an HTML document.

    Put your image and links within a new upploadare

    Link your local script to the HTML file and not the image file.

    Although personally, I'd use a modal window instead of these old pop-ups.

    Nancy O.

  • How to create a button to download files in the form?

    How to create a button to download files in the form?

    Hello

    Please refer to the link below with a similar discussion.

    Download file button

    Kind regards

    Vivek

  • How to create a button with rollover that appears in a different place than the button when you move?

    Hello

    How to create a button with rollover that appears in a different place than the button when you move by using only the Muse (reversal may be a different shape and color of the button). I managed to do it using Photoshop and the separate layers and import it, but it is not a good solution. All suggestions will be welcome.

    Thank you

    You can try to use the widget of the Composition of the ToolTip. In this way, the trigger area is isolated and a "State of reversal" can be placed anywhere on the screen (compared to the trigger).

    • Remove the two triggers additional default
    • Set to display the targets on working capital
    • Select hide all initially.
  • How to create a button that is persistent on the top of the Gallery HTML page

    Hello

    My InDesign folio, I have an article with photo gallery full HTML page. The photo grid occupies the full screen. I want to create a button that is persistent on top of this gallery, which the user can type to go to the main Menu page. This button is always visible in one place, even as the user scrolls up and down the gallery. I tried to create it on the top layer and the upper layer of the page master, but the button disapperas loading the HTML gallery.
    If the user does not see any button to navigate through the Gallery to another article.

    Any ideas how to create persistent button?

    Thanks in advance.

    -MP

    Why not do things just like an HTML article? You do it in the Muse.

  • How to create a button in AS3?

    Hello everyone

    How to create a button in the action script 3 and handle the click event?

    Thank you

    Maybe this will help you get started.

    import flash.display.Sprite;

    import flash.events.Event;

    import flash.display.Graphics;

    var button: Sprite = new Sprite();  Sprite to act as the image of the button.

    Set the color of the button image

    button.graphics.beginFill (0xFFCC00);

    The value of X, Y, width and height of the button image

    button.graphics.drawRect (10, 10, 200, 60);

    button.graphics.endFill (); Apply the fill

    this.addChild (button);  Add button Sprite to the stadium

    button.useHandCursor = true;

    button.buttonMode = true;

    button.mouseChildren = false;

    button.addEventListener (MouseEvent.CLICK, buttonClickHandler);

    function buttonClickHandler

    {

    trace ("button clicked!");

    }

  • How to create the Splashscreen for BlackBerry UiApplication?

    Hello!

    I'm new to BlackBerry,

    Can u tell me pls, how to create the SplashScreen.

    PLS, suggest me-

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/...

  • How to create a button "call" in sensitive site DW bootstrap?

    How to create a 'call now' (telephone) button in sensitive site DW bootstrap? I had such a button with jQuery a few years ago, but it doesn't seem to be compatible with the JS in a current model of DW. Thanks in advance.

    Ron Finley

    Use the such with phone number attribute.

    tel:12345678">Phone: 1-234-5678

    If you want a "bootstrap" button, add button classes.

    tel:12345678">Phone: 1-234-5678

    If the web device of the user does not have a phone app, it won't make any difference.

    Nancy O.

  • Adobe Acrobat Pro XI: How to create a button to trigger the copy of the text boxes?

    I created a form that includes a location of Customer Service and billing information customer fields (first name, name, address, city, State, zip, phone number, fax number, etc.).

    Is it possible to create a button to trigger/action respondent once clicked, it will automatically fill in the text based on the location information of customer billing Information Service customer?

    The only way I know how to do it is to have the fields in the Customer Service and billing named exactly the same information, but it still doesn't work. Some scenarios, the data are different in each section.

    You can do it using a script.

    The basic structure of this should be something like this:

    this.getField("TargetFieldName").value = this.getField("SourceFieldName").valueAsString;

  • How to create a button to add additional pages, duplicate in a form?

    Hello

    I created a form to fill out so that I can follow the results of the data in our laboratory. It is designed to be versatile, the fields are general enough to be used for a variety of tests. However, some tests require more samples to run than others, so I don't have a way across my document to match how many entries requires a given test. What I want to do is create a button to generate a second (or third or fourth) results page that laboratory analysts can click if they need additional reports entries. However, I don't have the first clue how to do this. any suggestions or pointers in the right direction would be really appreciated, thanks!

    Start with this tutorial: http://www.planetpdf.com/developer/article.asp?ContentID=6466

    It contains up to date information, but it will help you get started. Support Player 11 and DC model spawning.

  • How to create a button that scrolls down with page automatically?

    Hello

    I wanted to create a button that brings u to the top of the page when you press on, but I was wondering how to do scroll down with the page on the right side automatically when the some1 scrolls to the bottom of the page.

    An example I saw was on tumblr.com

    PS I'm a newbie, so please explain clearly. d.

    Thank you.

    This solution uses jQuery. When you scroll to halfway to the bottom of the page, an arrow appears on the right.  View source to see the code.

    http://ALT-Web.com/demos/jQueryBack-to-top.html

    Nancy O.

  • How to create Radio button that works like a Menu of rerouting

    Hi all

    Thanks in advanced for any help you can offer!

    I need assistance with Javascript that will dynamically created radio buttons act like the Menu for rerouting.

    Help, please. I need it as soon as POSSIBLE.

    I currently use several shortcuts menu (in Dreamweaver) to refresh the screen and additional Jump Menu on the screen. So that a user selects in the menu dropdown will refresh the page and update the content by following Menu go. I use Coldfusion for popular information. I use the URL to see the VARIABLES each refresh of the screen.

    Example URL: http://www.haysfluidcontrols.com/haysfluidcontrols/onlinecat/HoseKits.cfm

    ALSO, if any buddy knows how to create a Coldfusion page like this which are NOT REFRESHED when each choice, I'd LOVE to hear about it. I know of AJAX, but have not found anything made since then and have not been able to understand how incorperate it into my code.

    Thanks again,
    Matt

    Thanks for the comments everyone. I came up with a great solution. Thanks to Phil Hegedusich Direction. I am including my solution in this post. I also noticed that this code works with checkboxes.

    Thanks again for the help. I hope this helps others.

Maybe you are looking for