I need to detect when my BlackBerry application is sent to the background and also when it's brought to the foreground again. I need to pause 开发者_如何转开发the application when a phone call comes in and resume appropriately.
I assume this must be trivial to achieve but I can't find any reference to how this is done. Please put me out of my misery!
Gav
Take a look at the Application.activate() and Application.deactivate() methods - just override those methods in your app to define some custom behavior when these events occur.
If you need to know that the specific reason your app was sent to the background is because of an incoming phone call you can implement the PhoneListener interface and register via Phone.addPhoneListener(listener)
.
精彩评论