Thursday, April 7, 2011

Disable BackButton (Escape) and Default MenuItems in Blackberry

While implementing loader screen on network call, i faced a problem with back button(escape) on the device which removes the loader screen from the stack resulting in unexpected results.So i override the keychar method
 
protected boolean keyChar(char arg0, int arg1, int arg2) {
   
      if(arg0 == Keypad.KEY_ESCAPE ){
        return true;
      }else
        return super.keyChar(arg0, arg1, arg1);
 };


I still faced an issue loader screen closing on Blackberry button press.

So i overrided the onMenu method as

public boolean onMenu(int instance) {
  
   if(instance==1073741824)
     return super.onMenu(instance);

  //returning false to intimate menu is not created
  return false;
}


Finally solved...

No comments:

Post a Comment