RadioSC J2ME Radio

i have tested RadioSC with nokia 5200 and listening now :D
plug in your earphone before starting RadioSC

if you get exception about headset
just simply

exit RadioSC
unplug earphone
plug in earphone
start RadioSC





get RadioSC
jar
java



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package paket;

import java.io.IOException;
import javax.microedition.media.MediaException;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.Manager;
import javax.microedition.media.Player;

/**
* @author sertac
*/
public class RadioSC extends MIDlet implements CommandListener{

Display d;
Form f;
Command cmdPlay;
String channel;
TextField tfFreq;
Player player;
Command cmdExit;
static final String banner="www.SmobileZ.blogspot.com";

public RadioSC() {



d = Display.getDisplay(this);
f = new Form(banner);

tfFreq = new TextField("Channel", "90.60",5, TextField.ANY);
cmdPlay = new Command("Play",Command.OK, 1);
cmdExit = new Command("Exit",Command.EXIT, 2);

f.addCommand(cmdPlay);
f.addCommand(cmdExit);
f.append(tfFreq);


f.setCommandListener(this);





}

public void startApp() {
showSplash();

}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

public void commandAction(Command arg0, Displayable arg1) {

if (arg0==cmdPlay) {
try {

channel= tfFreq.getString();
player = Manager.createPlayer("capture://radio?f="+channel+"M&st=stereo");
player.start();

} catch (IOException ex) {
showException(ex);
} catch (MediaException ex) {
showException(ex);
}

}else if(arg0==cmdExit){
try {
player.stop();
notifyDestroyed();
} catch (MediaException ex) {
ex.printStackTrace();
}
}


}

private void showSplash() {
try {
Image logo = Image.createImage("/jpl.gif");
Alert splash = new Alert(banner, null, logo, null);
splash.setTimeout(5000);
d.setCurrent(splash, f);
} catch (IOException ex) {
d.setCurrent(f);
}
}

public void showException(Exception e){
d.setCurrent(new Alert(null,e.getMessage(),null,null));
}
}


Comments

Popular posts from this blog

Pyppeteer fix for BrowserError: Browser closed unexpectedly

overlay filesystem and containers

How to add pagination to django comments for your model