Results 1 to 4 of 4
- 04-19-2012, 11:37 PM #1
Member
- Join Date
- Apr 2012
- Posts
- 5
- Rep Power
- 0
J2ME, stop play after pressed button
Hello
I do alarm clock, but I have problem with stop play after pressing Stop button.
Thank you for your help
Java Code:public void commandAction(Command c, Displayable s) { try { Player player = Manager.createPlayer(getClass().getResourceAsStream("/ele.wav"), "audio/x-wav"); player.setLoopCount(3); player.prefetch(); if ( c == cmExit) { destroyApp(true); notifyDestroyed(); } if( c == cmActive) { player.start(); } if (c == cmCancel) { player.stop(); } } catch (Exception e) { e.printStackTrace(); } }Last edited by derata; 04-20-2012 at 11:57 AM.
- 04-20-2012, 12:09 AM #2
Member
- Join Date
- Apr 2012
- Posts
- 5
- Rep Power
- 0
Re: J2ME, stop play after pressed button
I know. Please delete.
- 04-20-2012, 10:42 AM #3
Re: J2ME, stop play after pressed button
This is a forum. Please share the solution.
Or do you visit a forum only to get and never to give?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 04-20-2012, 12:00 PM #4
Member
- Join Date
- Apr 2012
- Posts
- 5
- Rep Power
- 0
Re: J2ME, stop play after pressed button
I'm sorry
In Midlet
In startApp()Java Code:private Player player;
And commandActionJava Code:try { player = Manager.createPlayer(getClass().getResourceAsStream("/ele.wav"), "audio/x-wav"); player.setLoopCount(3); player.prefetch(); } catch (IOException ex) { ex.printStackTrace(); } catch (MediaException ex) { ex.printStackTrace(); } }
Java Code:public void commandAction(Command c, Displayable s) { if ( c == cmExit) { destroyApp(true); notifyDestroyed(); } if( c == cmActive) { try { player.start(); } catch (MediaException ex) { ex.printStackTrace(); } } if (c == cmCancel) { try { player.stop(); } catch (MediaException ex) { ex.printStackTrace(); } } }
Similar Threads
-
Do events while button is pressed
By garnaout in forum New To JavaReplies: 2Last Post: 01-24-2012, 08:43 PM -
How to set button to be pressed more than once
By ajs1351 in forum New To JavaReplies: 20Last Post: 12-04-2011, 06:53 AM -
Use stop button to stop moving (stop timers) on JPanel
By mneskovic in forum New To JavaReplies: 3Last Post: 07-23-2010, 12:50 PM -
Checking if a button was pressed in a Window.
By Valkyrie in forum New To JavaReplies: 2Last Post: 12-15-2009, 05:28 AM -
Waiting for a button to be pressed
By SomeGuyOverThere in forum New To JavaReplies: 6Last Post: 08-21-2008, 09:30 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks