BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-15-2008, 07:56 PM   #1
skynetchris
Knows Where the Search Button Is
 
Join Date: Apr 2008
Model: 7100T
PIN: N/A
Carrier: optus
Posts: 24
Default catch red/hangup button

Please Login to Remove!

Hi guys,

I have a program that should always popup a password screen when it starts up. The problem is that pressing the red hangup button simply puts the program into background, so the next person who opens it WONT be prompted for the password.

I'm trying to catch the KEY_END event and close the application (as per this thread).

Using this method:

Code:
class Password extends PopupScreen implements
   KeyListener, TrackwheelListener {
...
  public boolean keyDown (int keycode, int time){
       switch (keycode)
       {
            case 1179648:
                close();
                break; 
       }
    return false;
    }
It does SEEM to be possible, as this user points out in a therad at the end.

I've tried both methods (KEY_END and 1179648) Neither closing the application.

Any ideas?
Offline  
Old 05-16-2008, 05:44 AM   #2
jfisher
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Default

put your password popup or whatever in the activate method of UiApplcation:

Code:
public class myApp extends UiApplication {

 public static void main(String[] args) {
        myApp instance = new myApp();
        instance.enterEventDispatcher();
    }

public void activate() {
//push password prompt
}

}
'Handles foregrounding event.

The system invokes this method when it brings this application to the foreground. By default, this method does nothing. Override this method to perform additional processing when being brought to the foreground.'
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!

Last edited by jfisher; 05-16-2008 at 05:45 AM..
Offline  
Old 05-18-2008, 10:44 PM   #3
skynetchris
Knows Where the Search Button Is
 
Join Date: Apr 2008
Model: 7100T
PIN: N/A
Carrier: optus
Posts: 24
Default

That did the trick, thanks. Incase anyone comes across this problem, be sure to check there are no screens open before you prompt for password. Pretty easy:

Code:
    public void activate() {
    if(pWord.getContents() != null)
    {
        while(this.getScreenCount() > 1)
        {
            this.popScreen();
        }
        //Push password prompt because we've been put into background
        password = new Password();
        UiApplication.getApplication().invokeLater(new Runnable() {
            public void run(){
                UiApplication.getUiApplication().pushModalScreen(password);
            }
        });
    }
    }
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


10 x  SIEMENS QA120AFCN PLUG ON NEUTRAL 20A AFCI ARC FAULT BREAKERS NEW picture

10 x SIEMENS QA120AFCN PLUG ON NEUTRAL 20A AFCI ARC FAULT BREAKERS NEW

$329.95



Siemens Q120DFN 20A Dual AFCI/GFCI brakers NEW  ((((BOX OF 10)))) picture

Siemens Q120DFN 20A Dual AFCI/GFCI brakers NEW ((((BOX OF 10))))

$369.98



LOT OF 10 SIEMENS QA115AFCN 15A AFCI PLUG ON NEUTRAL (NO PIGTAIL WIRE) NEW picture

LOT OF 10 SIEMENS QA115AFCN 15A AFCI PLUG ON NEUTRAL (NO PIGTAIL WIRE) NEW

$358.99



Siemens 3RT1046-1AP60 Contactor picture

Siemens 3RT1046-1AP60 Contactor

$387.00



Siemens ALD-2I Analog Loop Driver for MXL Pyrotronics 580-891618 Made in USA picture

Siemens ALD-2I Analog Loop Driver for MXL Pyrotronics 580-891618 Made in USA

$499.95



1PCS New SIEMENS 6ES7 151-1AA06-0AB0 6ES7151-1AA06-0AB0 In Box Expedited Ship picture

1PCS New SIEMENS 6ES7 151-1AA06-0AB0 6ES7151-1AA06-0AB0 In Box Expedited Ship

$409.32







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.