How to create an exit button using onChangeListener

Hey this is the noob again. I finally my main screen GUI put in place and it looks great so now I want to add some features to my buttons. I have been looking around but little lost in how to do this, so here's some of my code. Right now I just try to make the exit button (that I created), exit the application and say something. Any help?  Oh, and another question, for another button, how could I get this button to switch screens to another category (for example a help button goes to a help page)

Thanks again!

That's what I have:

ButtonField exitBut = new ButtonField ("Exit", Field.FIELD_HCENTER)

FieldChangeListener listenerExitBut = new FieldChangeListener() {}
       
' Public Sub fieldChanged (field field, int context) {}
           
}
public boolean onClose()
{
Dialog.Alert ("Bye World!");
System.Exit (0);
Returns true;
}
};
       
exitBut.setChangeListener (listenerExitBut);
   
fieldManagerMid.add (exitBut);

You can instance fieldChangeListener in 2 ways

1. create an internal interface of the fieldChangeListener

2. to implement the fieldChangeListener in your screen

in this Sub fieldChanged, you need to determine the user click

public void fieldChanged(Field field, int context) {
   if (field == exitBut)
   {
      Dialog.alert("Bye World!");
      System.exit(0);
   }
}

Correct me if I'm wrong

Tags: BlackBerry Developers

Similar Questions

  • How to create the user account using the command?

    How to create the user account using the command?

    Open cmd as administrator, and then type the following commands one after the other

    NET user / add program mypassword
    net localgroup administrators program / add
    net share concfg * C:------/ grant: program, complete
    This will create a user account with the name "Program" and the password "MonMotpasse".

    You can create the user name and password of your choice.
  • How to create e-commerce site using adobe muse from the beginning to the end, please

    How to create e-commerce site using adobe muse from the beginning to the end, please

    Mylenium, why comment you on the forums of Muse? I've never seen a useful comment on these forums. You seem to just upset against Muse all the time.

    in any case, definitely go with widgets Ecwid and J-26. They are the best.

  • Please how to create an e-commerce using the muse of adobe

    Please how to create an e-commerce using the muse of adobe

    ECWID is certainly the easiest to customize muse and it's very easy for customers to add/manage products. Another thing that many people love in Ecwid, it's that you can host several stores account. If you know css/javascript then you can do this on your own, but if you want a widget that does, make these widgets.

    If you are looking for some great Ecwid widgets, you can enter these ones that are free. And if you are wanting to customize even more (including the ability to host multiple account stores), you can get these even more impressive widgets for $14.99 with promo code: 1MUSESTORE #.

  • How to create a menu button of 3 lines for navigation on a mobile site?

    How to create a menu button of 3 lines for navigation on a mobile site and do trigger the Accordion Panel? I created my first sites on Muse and can't seem to understand.

    Download icons FontAwesome and install it manually.
    https://fortawesome.github.IO/font-awesome/

    Add web fonts self-hosted | Adobe Muse CC tutorials

  • How to create our own button to print the dashboard to PDF

    Hi Experts,

    Someone can tell me how to create our own button to print in PDF dashboards, and similarly to save, we create a button more. The one facing this type of requirement can.

    Thank you
    Malli

    CheminPortail = / shared, KeyBank, _portal, Test AND page = name1
    In your code below shud be the same portal path of your dashboard and page shud exactly equals name of the page you want to view in pdf format. It was just an example I gave you. Replace the 2 values and you are done

  • How to create a search button custom Muse that shares the page on Facebook?

    Hello

    I tried to find the answer in the forum and on Google but I don't have a chance. What I'm trying to do is to create a search button custom from scratch in Muse, and when he is selected to share the web page it sits.

    What I did, is to have a share of full-screen, but I can't do it in a pop-up window as in most of the sites with the photo that describes the site.

    The button example how far is here: www.razgledaj.me

    THX

    Marko

    Try this, use your own image for the button and the url to share:

    http://www.mindfiresolutions.com/creating-a-custom-share-on-Facebook-button-453.php

    Thank you

    Sanjit

  • How to create an image button...

    Tools: Adobe Photoshop CS5

    Master level: very novice

    Goal: Creat Button for a website

    Environment: Windows Vista

    Problem: the following images are buttons was designd. An image is in the normal state, while the other button is in State rollver. I want to create an image of indetical with the same properties for example (size, font type, font size, background color of color police) called "intuitive healer". I don't know how to imitate the fonts and background colors.

    klass2b_b2.gifnormal status of a button

    klass2b_b2_over.gifbutton rollover

    Intuitive healer? normal

    Intuitive healer? Rollover

    I'm curious to know how to create a button with the exact "look and feel" design and writing on this healer Inutive

    Make my day

    the guy looks like both a new Roman font.  If you follow the tutorial below, it sets out nicely. you simply omit the gradient and effects that they do in the tutorial, to match the one you want on it. It will associate Dreamweaver and Photoshop.

    Flight path Imaging:

    http://help.Adobe.com/en_US/Photoshop/CS/using/WS18F9E180-3241-4891-ACC8-82C9DFB254F5a.htm l

    Watch this video:

    http://www.YouTube.com/watch?v=_pVfBtW-Tuq

    -good luck!

    Janelle

  • How to create a done button on the bottom in the center of the screen

    Hello

    I encode a preference window for my application, which is a normal screen. I have several controls text and choices on the page and I would like to add a button called 'Complete' on the bottow of the screen Center. Please advise,

    Thank you

    Henry

    Not tested, but I think it should work.

    Create a ButtonField done, using style Field.FIELD_HCENTER.  Add to a VerticalFieldmanager.  Change you to be a display screen and add the VerticalFieldManager to the screen using setStatus, i.e.

    .setStatus ();

    Let us know if it does not work.

  • How to create a play button to start video?

    I embedded a video in a slide and I would like to create a 'play' button that triggers the playback of this video.

    Is that possible through the unique actions on captivate 9?

    Thanks in advance for your answer.

    You insert video as video multi Slide? Only then can it be controlled by Captivate. Use a button (form) with a stopping point just before the beginning of the video timeline:

  • How to create a dashboard button?

    I need to create a simple button and show a pix in Edge animate. Would like to have mouseover action, but a simple click on would be enough. Thank you

    Hello

    Here's a demo file to download: aButton.zip - Box

    (1) I slipped and dropped an image on stage.

    (2) that I created 3 examples.

    (3) by default, I cache the image by using the properties panel. Then I show using: sym.play(1000) (). Chronology is played.

  • How to create a clean button for captioning

    Hello

    I created my own buttons for play, stop, etc the output. But I don't know how to create a button to display closed captioning.  I tried a few hours but I give up. What should I do? :

    First clik - captioning will appear.

    Second clik - captioning will disappear.

    And so on appear/disappear/appear/disappear

    Help please!

    Poul

    Take a look on: buttons in the form of rocking - Captivate 6 - Captivate blog

    Replace the variable cpCmndMute of cpCmndCC system and you will have the choice between different scenarios.

  • How to create a flat rack using vanishing point

    Hi, I'm trying to follow this tutorial on how to create anamorphic images and I don't know how to use the vanishing point. I have no idea to create a flat grid as it says. Also, does the number of lines in a case of grid? Because in the picture it's like five lines throughout, and when I create a grid, it's at least twenty lines everywhere.

    If someone could help me, that would be helpful! I have an art of the final scheduled in two days.

    Activate the Vanishing Point filter.

    Click on the four corners of a rectangle.

    The size of the grid is not important for the functioning of the filter: it is a visual aid. It is adjusted by the control labeled "Size of the grid" upstairs to the left of the filter window. The tutorial is said to use 121 on an A4 page, so you should do it.

    In the dropdown at the top left menu, choose "make grids to Photoshop".

    Click OK at the bottom right to complete the creation of grid and out the filter.

  • How to create a dynamic newsflash using dreamweaver and PHP

    Hello

    I would like to create a dynamic newsflash using dreamweaver and PHP because newsflash will be snapped up information from a MySQL database. The Bulletin-Flash should also have a link to view more information about the piece of news a user wants to learn more. What tools do I need to use in dreamweaver and how is the procedure to go about it. All opinions are appreciated. Thanks in advance!

    Sermon of Ras wrote:

    I tried using the spry effects, but it does not work. Is there a best way to do this?

    Google "jquery vertical newsticker" ;-)

  • How to create a scrolling pages using Acrobat 5.0 for Windows (multi)

    How to create a multi page document that can be scrolled? I want to place a drawing, I have in pdf format, on each page of the document, and then send via email if the recipient can open and scroll through the pages to see all the designs.

    If I understand your situation, you have a lot of PDFs, each with a chart. You want to combine. Just open the first PDF and then go to Document > insert Pages to add pages. If they come out in the wrong order, simply use the thumbnails to rearrange. Save the file using Save as.

Maybe you are looking for

  • Firefox no longer works. Says it works. Try to access with no result. Unable to access the most

    I get this message. "Firefox is already running but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system. » No matter what I do, I can't access Firefox. It says message even if I close mac

  • Turn on the password?

    My father-in-law gave me his old computer it is a 'hpG60' p/n 'NW149UA #ABA' and model # G60 - 447 CL Notebook PC in any case, when I turned it on it asked me to enter a "Power on password"? I asked my father-in-law, but he was able to remember where

  • Satellite 5200-device display 801:Quick switch (Fn + F5)

    I have a problem regarding the fast display device switching "pressing the (Fn) with (F5)" nothing happen as usual... does everything body knows how to fix it! Thanks in advance. my laptop is 5200-801 with Nvidia 460Go with 46 MB.

  • Need help... Internet speeds crawl after upgrading Vista to 7 Ultimate on HP tx 2000

    Hi all I was wondering if I could get help about an annoying problem that arose. I've recently upgraded the OS on my HP tx2000 tablet PC from Vista Home Premium to Ultimate 7. Internet speeds were very well then; I decided to investigate why the supp

  • updates do not download or install

    my updates of windows said I have 75 reviews and 2 recommended updates. I told him to go ahead and the progress bar is sitting for hours with no downloads that occur. The last time it worked was 4 months ago. have you tried reboots, no effect.