JeremX Posted February 20, 2011 Share Posted February 20, 2011 Bonjour, j'ai un petit soucis au niveau de l'ouverture d'une adresse web. J'ai créé un menu qui contient un sous-menu. J'aimerai que lorsque j'appuie sur l'un des sous-menu, le navigateur web se lance et m'affiche la page que j'ai défini moi-même. J'ai cherché un peu partout mais je n'ai pas vraiment trouvé la réponse à mon problème pour ce cas précis. Est-ce que quelqu'un sait si c'est possible et si oui, comment? Merci. :) Link to comment Share on other sites More sharing options...
Sylvaner Posted February 20, 2011 Share Posted February 20, 2011 Uri uri = Uri.parse("http://www.google.fr"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); Link to comment Share on other sites More sharing options...
JeremX Posted February 20, 2011 Author Share Posted February 20, 2011 J'avais déjà essayé mais ça ne marchait pas. Voici le bout de code: case R.id.site: Uri uri = Uri.parse("http://www.google.fr"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); return true; Link to comment Share on other sites More sharing options...
chpil Posted February 20, 2011 Share Posted February 20, 2011 Et il se passe quoi ? Tu as une erreur ? Une exception ? Une trace de log ? Parce que, "ça ne marche pas" ... c'est pas ça qui va nous permettre de t'aider... Link to comment Share on other sites More sharing options...
JeremX Posted February 20, 2011 Author Share Posted February 20, 2011 Uri cannot be resolved to a typeIntent cannot be resolved to a variable Intent cannot be resolved to a type Link to comment Share on other sites More sharing options...
chpil Posted February 20, 2011 Share Posted February 20, 2011 Ah oui.... tu pars de loin, là... Par hasard, il ne te manquerait pas des imports dans ta classe Java ?? ( Ctrl-Shift-O pour les ajouter 'automagiquement' dans Eclipse) Link to comment Share on other sites More sharing options...
JeremX Posted February 20, 2011 Author Share Posted February 20, 2011 Il me manquait bien des imports mais ceux-ci n'étaient pas indiqués dans les tutos que j'avais trouvés... Cela marche maintenant, merci à toi pour l'info et l'astuce pour ajouter automatiquement les imports. ;) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.