Java 使用内容处理程序API(JSR211)打开应用程序

Java 使用内容处理程序API(JSR211)打开应用程序,java,java-me,mobile-phones,Java,Java Me,Mobile Phones,我希望能够使用诺基亚6212上的内容处理程序API(JSR 211)通过我的应用程序启动本机和J2ME应用程序 目前,我无法这样做,因为它总是声明“找不到内容处理程序”,并抛出一个javax.microedition.Content.ContentHandlerException 目前,我正在尝试让手机启动浏览器并访问某个网站,只是为了测试我是否可以使用该框架。我尝试了许多不同的调用对象: //throw exceptions new Invocation("http://www.somesit

我希望能够使用诺基亚6212上的内容处理程序API(JSR 211)通过我的应用程序启动本机和J2ME应用程序

目前,我无法这样做,因为它总是声明“找不到内容处理程序”,并抛出一个
javax.microedition.Content.ContentHandlerException

目前,我正在尝试让手机启动浏览器并访问某个网站,只是为了测试我是否可以使用该框架。我尝试了许多不同的
调用
对象:

//throw exceptions
new Invocation("http://www.somesite.com/index.html",
  "application/internet-shortcut");
new Invocation("http://www.google.co.uk","text/html");
// a long shot, I know
new Invocation("http://www.somesite.com/text.txt","text/plain");
// massive long shot
new Invocation("http://www.google.co.uk","application/browser");

//appears to download the link and content (and definitely does in the Nokia
// emulator) and then throws an exception
new Invocation("http://www.google.co.uk");
new Invocation("http://www.somesite.com/index.html");
下面是我一直在使用的代码,请记住经常更改参数以生成不同的
调用
对象

/*
 * Invokes an application using the Content Handler API
 */
public void doInvoke(String url, String mime, String payload){
    Registry register = Registry.getRegistry(this.getClass().getName());
    Invocation invoke = new Invocation(url, mime, null, false,
      ContentHandler.ACTION_OPEN);

    boolean mustQuit = false;

    try {
        mustQuit = register.invoke(invoke);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (ContentHandlerException e) {
        e.printStackTrace();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    if(mustQuit){
        this.quit();
    }
}
试试这个:

Registry register = Registry.getRegistry(this.getClass().getName());
必须为MIDlet继承器调用
Registry.getRegistry
。只需使用MIDlet获取类名。

试试以下方法:

Registry register = Registry.getRegistry(this.getClass().getName());
必须为MIDlet继承器调用
Registry.getRegistry
。只需使用MIDlet获取类名