BlackBerryForums.com : Your Number One BlackBerry Community  
   

»Sponsored Links



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

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?
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
jfisher Offline
CrackBerry Addict
 
jfisher's Avatar
 
Posts: 711
Join Date: Jun 2005
Location: Manchester, UK
Model: 8310
Carrier: t-mobile
Default 05-16-2008, 05:44 AM

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.'

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

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);
            }
        });
    }
    }
   
Reply With Quote
Reply


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On






Copyright © 2004-2008 BlackBerryNews.com, BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.1