I feel stupid. But thank you. 
Actually there were some more bugs, but with your help I got sensible output so I could find the others.
I suspect this is trivial to most of you, but in case anyone else are having similar problems, I post my finished code here. It's a simple program in which you can enter the name of a protocol and get out which contenttypes can be used with it, or vice versa. Distribute freely.
Code:
/*
* A simple test program for testing which media protocols are supported by a j2me phone,
* and which content types can be used with certain protocols.
*
* @author Anders Sundnes Løvlie
* folk.uio.no/anderssl
* a.s.lovlie at media.uio.no
*
*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
public class Streamtest extends MIDlet implements CommandListener {
private TextBox textbox;
private Form form;
private TextField pField, cField;
private Display display;
private Command protocolCommand, contentCommand, exitCommand, backCommand;
private String[] supported = new String[30];
private String[] protocols = new String[10];
public Streamtest() {
// User interface
form = new Form("Media protocols test");
pField = new TextField("Protocol:", "http", 100, TextField.ANY);
cField = new TextField("Content type:", "audio/mpeg", 100, TextField.ANY);
protocolCommand = new Command("Test protocol", Command.SCREEN, 0);
contentCommand = new Command("Test content", Command.SCREEN, 0);
exitCommand = new Command("Exit", Command.EXIT, 1);
backCommand = new Command("Back", Command.SCREEN, 1);
form.append(pField);
form.append(cField);
form.addCommand(protocolCommand);
form.addCommand(contentCommand);
form.addCommand(exitCommand);
form.setCommandListener(this);
display = Display.getDisplay(this);
}
public void findContentTypes(String protocol){
if (protocol != null && protocol != ""){
try {
supported = Manager.getSupportedContentTypes(protocol);
}
catch (Exception e){
showAlert("Error", "Something went wrong when finding contenttypes:" + e);
return;
}
}
else {
showAlert("Error", "The protocol variable is empty; did you forget to write something in the protocol field?");
return;
}
displayResults(supported,protocol);
}
public void findProtocols(String contenttype){
if (contenttype != null && contenttype != ""){
try {
protocols = Manager.getSupportedProtocols(contenttype);
}
catch (Exception e){
showAlert("Error", "Something went wrong when finding protocols: " + e);
return;
}
}
else {
showAlert("Error", "The content variable is empty; did you forget to write something in the content field?");
return;
}
displayResults(protocols, contenttype);
}
public void displayResults(String[] results, String teststring){
String output = "";
try {
if (results == null){
output += "Error: '" + teststring + "' not supported on this phone. (Results was 'null'.)";
}
else if (results.length<1){
output += "Error: '" + teststring + "' not supported on this phone. (Length of results was 0.)";
}
else if (results[0] == null){
output += "Error: '" + teststring + "' not supported on this phone. (Result array is empty.)";
}
else {
output = "Number of entries: " + results.length + "\n";
for(int i=0; i<results.length; i++){
output += results[i] + "\n";
}
}
}
catch (Exception e){
output = "Something went wrong when finding results: " + e;
}
textbox = new TextBox("Streaming test", output, 4000, TextField.ANY);
textbox.addCommand(exitCommand);
textbox.addCommand(backCommand);
textbox.setCommandListener(this);
display.setCurrent(textbox);
}
public void commandAction(Command c, Displayable s) {
if (c == exitCommand){
destroyApp(false);
notifyDestroyed();
}
else if (c == protocolCommand){
String teststring = pField.getString();
findContentTypes(teststring);
}
else if (c == contentCommand){
String teststring = cField.getString();
findProtocols(teststring);
}
else if (c == backCommand){
display.setCurrent(form);
textbox = null;
}
}
public void showAlert(String title, String message){
Alert alert = new Alert(title, message, null, AlertType.ERROR);
display.setCurrent(alert);
}
public void startApp(){
display.setCurrent(form);
}
public void pauseApp(){
}
public void destroyApp(boolean condition){
}
}