Je veux être en mesure de lancer des applications natives et J2ME par mon application à l'aide d'un Nokia 6212.Utilisation de l'API de gestionnaire de contenu (JSR 211) pour ouvrir des applications
l'API de gestionnaire de contenu (JSR 211) Au moment , Je suis incapable de le faire, car il indique toujours qu'il y a "No Content Handler Found" et jette un javax.microedition.content.ContentHandlerException
.
En ce moment, j'essaie d'obtenir le téléphone pour lancer son navigateur et aller à un certain site Web, juste pour tester que je peux utiliser le cadre. J'ai essayé beaucoup de différents objets Invocation
:
//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");
est Ci-dessous le code que je l'ai utilisé, s'il vous plaît garder à l'esprit les paramètres souvent modifiés pour générer les différents objets Invocation
.
/*
* 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();
}
}