Skip to main content

How to know when the app is in front?

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
3 replies [Last post]
abuhmead1987
Offline
Joined: 2010-04-21

Dear Guys, My app has a background sound, and a link to a website, The website opened in the default browser when the user pressed on show command, I want to pause the audio while the application in the background, so, I want to know which method called when the app running in the background, and which method called when the user back to my app (My app shown again)? I tried to override hideNotify(); and showNotify(); but the result is not like which I want!

Thanks a lot in advance!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vprise
Offline
Joined: 2003-11-07

There is no event for application minimization. However, isMinimized() might work for most devices.

abuhmead1987
Offline
Joined: 2010-04-21

The application will not minimized, it will stay running but not on the top. The mobile browser on the top, and when i close the mobile browser my app will appear on the front.

vprise
Offline
Joined: 2003-11-07

Many devices don't have a concept of minimization or even multi-tasking.